Uncompress the source:
[src]# tar -xzf mysql-3.23.40.tar.gz
Change to mysql source root, and add mysql group and user:
[src]# cd my* [mysql-3.23.40]# groupadd mysql [mysql-3.23.40]# useradd -g mysql mysql
Run configure, specifying installation directory as /usr/local/mysql:
[mysql-3.23.40]# ./configure --prefix=/usr/local/mysql creating cache ./config.cache checking host system type... i586-pc-linux-gnu . . . Remember to check the platform specific part in the reference manual for hints about installing on your platfrom. See the Docs directory. Thank you for choosing MySQL!
Run make, make install:
[mysql-3.23.40]# make cd include; make link_sources make[1]: Entering directory `/usr/local/src/mysql-3.23.40/include' . . . make[2]: Nothing to be done for `all-am'. make[2]: Leaving directory `/usr/local/src/mysql-3.23.40' make[1]: Leaving directory `/usr/local/src/mysql-3.23.40' [mysql-3.23.40]# [mysql-3.23.40]# make install Making install in include make[1]: Entering directory `/usr/local/src/mysql-3.23.40/include' . . . make[2]: Leaving directory `/usr/local/src/mysql-3.23.40' make[1]: Leaving directory `/usr/local/src/mysql-3.23.40' [mysql-3.23.40]#
Let’s create the MySQL grant tables:
[mysql-3.23.40]# scripts/mysql_install_db Preparing db table Preparing host table . . . Support MySQL by buying support/licenses at https://order.mysql.com [mysql-3.23.40]#
Let’s change some permissions:
[mysql-3.23.40]# chown -R root /usr/local/mysql [mysql-3.23.40]# chown -R mysql /usr/local/mysql/var [mysql-3.23.40]# chgrp -R mysql /usr/local/mysql
Copy a a configuration file to start with:
[mysql-3.23.40]# cp support-files/my-medium.cnf /etc/my.cnf
Let’s start up the MySQL daemon:
[ /root]# /usr/local/mysql/bin/safe_mysqld & [1] 31730 [/root]# Starting mysqld daemon with databases from /usr/local/mysql/var [/root]#
Let’s set a password for MySQL root user:
[mysql]# /usr/local/mysql/bin/mysqladmin -u root -p password 'password' Enter password: [mysql]# [mysql]# /usr/local/mysql/bin/mysqladmin -u root -h srv-33.signalq.com -p password 'password' Enter password: [mysql]#
Note that the existing password is blank, and, of course, you should replace password with your favorite password. 🙂
Let’s check the version:
[root@srv-33 mysql]# /usr/local/mysql/bin/mysqladmin version -p Enter password: /usr/local/mysql/bin/mysqladmin Ver 8.21 Distrib 3.23.40, for pc-linux-gnu on i586 Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL license Server version 3.23.40-log Protocol version 10 Connection Localhost via UNIX socket UNIX socket /tmp/mysql.sock Uptime: 37 min 3 sec Threads: 1 Questions: 10 Slow queries: 0 Opens: 7 Flush tables: 1 Open tables: 1 Queries per second avg: 0.004 [mysql]#
There is a script in mysql-test called mysql-test-run that will run extensive tests. Modify the path in the script to include /usr/local/mysql/bin, and run:
[mysql-test]# ./mysql-test-run Installing Test Databases Removing Stale Files Installing Master Databases 010801 0:41:57 ../sql/mysqld: Shutdown Complete Installing Slave Databases 010801 0:41:58 ../sql/mysqld: Shutdown Complete Starting MySQL daemon Loading Standard Test Databases Starting Tests TEST USER SYSTEM ELAPSED RESULT ------------------------------------------------------------------------ alias 0.49 0.24 1.30 [ pass ] alter_table 0.10 0.13 0.39 [ pass ] . . . variables 0.10 0.12 0.23 [ pass ] warnings 0.15 0.07 0.25 [ pass ] ------------------------------------------------------------------------ Ending Tests Shutting-down MySQL daemon Master shutdown finished Slave shutdown finished All 125 tests were successful. [mysql-test]#
Add the following to /etc/rc.local to start MySQL automatically:
/usr/local/mysql/share/mysql/mysql.server start
You could use many methods for this, but rc.local is more generic.
We also need to add these lines to /etc/my.cnf:
[mysql.server] basedir=/usr/local/mysql
And under the [mysqld] section in /etc/my.cnf:
datadir = /usr/local/mysql/var user = mysql
Here is how we tweaked the module config on webmin to manage our MySQL server.
Check out our BIND Automation page for more info on webmin.
Here is what the webmin MySQL manager screen looks like.
We have a database server. Rejoice!