D.1. Installing and Configuring a Remote MySQL Database (InnoDB)

The following procedure describes how to install MySQL 5.1 with an InnoDB storage engine on an Oracle Solaris x86 host.

  1. Create the file /etc/my.cnf, and add the following content.

    [mysqld]
    user=mysql
    datadir=/usr/local/mysql/data
    basedir=/usr/local/mysql
    port=3306
    socket=/tmp/mysql.sock
    max_allowed_packet=20M
    #transaction_isolation=READ-COMMITTED
    lower_case_table_names=1
    max_connections=1000
    skip-locking
    key_buffer=16K
    table_cache=4
    sort_buffer_size=64K
    net_buffer_length=2K
    thread_stack=64K
    wait_timeout=31536000
    
    innodb_data_home_dir=/usr/local/mysql/data
    innodb_data_file_path=ibdata1:10M:autoextend
    innodb_log_group_home_dir=/usr/local/mysql/data
    innodb_buffer_pool_size=50M
    innodb_additional_mem_pool_size=10M
    innodb_log_file_size=5M
    innodb_log_buffer_size=10M
    innodb_flush_log_at_trx_commit = 1
    innodb_lock_wait_timeout = 50
  2. Create a user "mysql" and a group "mysql" by running the following commands.

    # groupadd mysql
    # useradd -g mysql mysql
  3. Get the MySQL tar file, untar it, and keep it in the / directory.

  4. Create the directory /usr/local, by running the following command.

    # mkdir /usr/local
  5. Change to the new directory, and create a symbolic link, called "mysql", that points to the MySQL files in the directory, by running the following commands.

    # cd /usr/local
    # ln -s /mysql-5.1.30-solaris10-i386 mysql
    # ls -lrt
    
    
    total 2
    lrwxrwxrwx 1 root root 35 Nov 12 17:33 mysql -> /export/mysql-5.1.30-solaris10-i386
    bash-3.00#
  6. Make sure that the directory contains the proper owner and group permissions by running the following commands.

    # chgrp -R mysql /mysql-5.1.30-solaris10-i386
    # chown -R mysql /mysql-5.1.30-solaris10-i386
  7. Check the permissions for the directory as well.

    # cd /usr/local/mysql
    # ls -lrt
    
    -rw-r--r-- 1 mysql mysql 19071 Nov 15 13:07 COPYING
    -rw-r--r-- 1 mysql mysql 5139 Nov 15 13:07 EXCEPTIONS-CLIENT
    -rw-r--r-- 1 mysql mysql 8767 Nov 15 13:07 INSTALL-BINARY
    -rw-r--r-- 1 mysql mysql 1410 Nov 15 13:07 README
    drwxr-xr-x 2 mysql mysql 1536 Nov 15 13:07 bin
    drwxr-xr-x 4 mysql mysql 512 Nov 15 13:07 data
    drwxr-xr-x 2 mysql mysql 512 Nov 15 13:05 docs
    drwxr-xr-x 2 mysql mysql 1024 Nov 15 13:05 include
    drwxr-xr-x 3 mysql mysql 1024 Nov 15 13:06 lib
    drwxr-xr-x 4 mysql mysql 512 Nov 15 13:06 man
    drwxr-xr-x 10 mysql mysql 512 Nov 15 13:07 mysql-test
    drwxr-xr-x 2 mysql mysql 512 Nov 15 13:07 scripts
    drwxr-xr-x 27 mysql mysql 1024 Nov 15 13:07 share
    drwxr-xr-x 5 mysql mysql 1024 Nov 15 13:07 sql-bench
    drwxr-xr-x 2 mysql mysql 512 Nov 15 13:07 support-files
  8. From the /usr/local/mysql directory, run the following command, and check that it provides the corresponding output.

    # ./scripts/mysql_install_db --user=mysql
    
    To start mysqld at boot time you have to copy support-files/mysql.server to the 
    right place for your system
    
    PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
    To do so, start the server, then issue the following commands:
    
    /usr/local/mysql/bin/mysqladmin -u root password 'new-password'
    /usr/local/mysql/bin/mysqladmin -u root -h wipro-33 password 'new-password'
    
    Alternatively you can run:
    /usr/local/mysql/bin/mysql_secure_installation
    
    which will also give you the option of removing the test databases and anonymous 
    user created by default. This is strongly recommended for production servers.
    
    See the manual for more instructions.
    
    You can start the MySQL daemon with:
    cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &
    
    You can test the MySQL daemon with mysql-test-run.pl 
    cd /usr/local/mysql/mysql-test ; 
    perl mysql-test-run.pl
    
    Please report any problems with the /usr/local/mysql/scripts/mysqlbug script!
    
    The latest information about MySQL is available at http://www.mysql.com/ Support MySQL 
    by buying support/licenses from http://shop.mysql.com/
  9. From the /usr/local/mysql directory, run the following command, and check to see that you get the corresponding output.

    # ./bin/mysqld_safe --defaults-file=/etc/my.cnf --ledir=/usr/local/mysql/bin --user=mysql &
    [1] 15885
    # 090323 22:36:26 mysqld_safe Logging to '/usr/local/mysql/data/wipro-33.err'.
    090323 22:36:26 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
  10. Now, leave the terminal just the way it is. To make sure the process you just enabled is running all the time, go to the console and start this process.

    # cd /usr/local/mysql/bin
    # ./mysql --user=root
    Welcome to the MySQL monitor. Commands end with ; or g.
    Your MySQL connection id is 1
    Server version: 5.1.30 MySQL Community Server (GPL)
    
    Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
    
    mysql>
  11. Stop the MySQL daemon by running the following command in a terminal, if you want to stop the daemon.

    # ./mysqladmin shutdown

    When the command is run, the terminal, that was left alone, should give the following output.

    # /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf --ledir=/usr/local/mysql/bin 
    --user=mysql &
    [1] 16017
    # 090323 22:47:38 mysqld_safe Logging to '/usr/local/mysql/data/wipro-33.err'.
    090323 22:47:38 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
    090323 22:49:31 mysqld_safe mysqld from pid file /usr/local/mysql/data/wipro-33.pid ended