To install and configure MySQL, follow these steps:
Follow the installation instructions provided at the MySQL website.
See http://dev.mysql.com/doc/refman/5.0/en/installing-binary.html.
The following is output from an installation session:
# groupadd mysql # useradd -g mysql mysql # pwd /opt/MySQL # ls -al total 106 drwxr-xr-x 14 root root 512 Jan 2 12:48 . drwxr-xr-x 30 root sys 1024 Jan 2 12:40 .. drwxr-xr-x 2 root root 2048 Jan 2 12:48 bin -rwxr-xr-x 1 root root 801 Jan 2 12:48 configure -rw-r--r-- 1 root root 19071 Jan 2 12:48 COPYING drwxr-x--- 4 root root 512 Jan 2 12:48 data drwxr-xr-x 2 root root 512 Jan 2 12:48 docs -rw-r--r-- 1 root root 5139 Jan 2 12:48 EXCEPTIONS-CLIENT drwxr-xr-x 3 root root 1536 Jan 2 12:48 include -rw-r--r-- 1 root root 8528 Jan 2 12:48 INSTALL-BINARY drwxr-xr-x 2 root root 512 Jan 2 12:48 lib drwxr-xr-x 4 root root 512 Jan 2 12:48 man drwxr-xr-x 9 root root 512 Jan 2 12:48 mysql-test -rw-r--r-- 1 root root 1410 Jan 2 12:48 README drwxr-xr-x 2 root root 512 Jan 2 12:48 scripts drwxr-xr-x 3 root root 512 Jan 2 12:48 share drwxr-xr-x 5 root root 1024 Jan 2 12:48 sql-bench drwxr-xr-x 2 root root 512 Jan 2 12:48 support-files drwxr-xr-x 2 root root 512 Jan 2 12:48 tests # chown -R mysql . # chgrp -R mysql . # ls -al total 106 drwxr-xr-x 14 mysql mysql 512 Jan 2 12:48 . drwxr-xr-x 30 root sys 1024 Jan 2 12:40 .. drwxr-xr-x 2 mysql mysql 2048 Jan 2 12:48 bin -rwxr-xr-x 1 mysql mysql 801 Jan 2 12:48 configure -rw-r--r-- 1 mysql mysql 19071 Jan 2 12:48 COPYING drwxr-x--- 4 mysql mysql 512 Jan 2 12:48 data drwxr-xr-x 2 mysql mysql 512 Jan 2 12:48 docs -rw-r--r-- 1 mysql mysql 5139 Jan 2 12:48 EXCEPTIONS-CLIENT drwxr-xr-x 3 mysql mysql 1536 Jan 2 12:48 include -rw-r--r-- 1 mysql mysql 8528 Jan 2 12:48 INSTALL-BINARY drwxr-xr-x 2 mysql mysql 512 Jan 2 12:48 lib drwxr-xr-x 4 mysql mysql 512 Jan 2 12:48 man drwxr-xr-x 9 mysql mysql 512 Jan 2 12:48 mysql-test -rw-r--r-- 1 mysql mysql 1410 Jan 2 12:48 README drwxr-xr-x 2 mysql mysql 512 Jan 2 12:48 scripts drwxr-xr-x 3 mysql mysql 512 Jan 2 12:48 share drwxr-xr-x 5 mysql mysql 1024 Jan 2 12:48 sql-bench drwxr-xr-x 2 mysql mysql 512 Jan 2 12:48 support-files drwxr-xr-x 2 mysql mysql 512 Jan 2 12:48 tests # scripts/mysql_install_db --user=mysql Installing MySQL system tables... OK Filling help tables... OK 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: ./bin/mysqladmin -u root password 'new-password' ./bin/mysqladmin -u root -h HostName-01 password 'new-password' See the manual for more instructions. You can start the MySQL daemon with: cd . ; ./bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd mysql-test ; perl mysql-test-run.pl Please report any problems with the ./bin/mysqlbug script! The latest information about MySQL is available on the web at http://www.mysql.com Support MySQL by buying support/licenses at http://shop.mysql.com # # chown -R root . # chown -R mysql data # bin/mysqld_safe --user=mysql & 5994 Starting mysqld daemon with databases from /opt/MySQL/data |
Stop the MySQL server.
# cd /opt/MySQL # ./bin/mysqladmin -u root -p shutdown Enter password: <"password"> STOPPING server from pid file /opt/MySQL/data/HostName-01.pid 080104 09:39:21 mysqld ended [1]+ Done ./bin/mysqld_safe # |
Set the password for the root user in MySQL.
# ./bin/mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 6 Server version: 5.0.45-log MySQL Community Server (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('password'); Query OK, 0 rows affected (0.00 sec) mysql> SET PASSWORD FOR 'root'@'HostName-01' = PASSWORD('password'); Query OK, 0 rows affected (0.01 sec) mysql> exit Bye # |
Set environment parameters for the MySQL script.
Change the file /opt/MySQL/support-files/mysql.server:
basedir=/opt/MySQL datadir=/opt/MySQL/data ... basedir=/opt/MySQL bindir=/opt/MySQL/bin # cp /opt/MySQL/support-files/mysql.server /etc/sfw/mysql |
Start the MySQL server.
# cd /opt/MySQL # ./bin/mysqld_safe --user=mysql --log& [1] 7764 # Starting mysqld daemon with databases from /opt/MySQL/data # |