HOW TO: Install MySQL on Linux (TEST environment)


1)

Download the supported version of MySQL 5.0.x database from their website. Make sure you download the non-RPM package.

2)

Verify the integrity of the download by comparing the locally computed message digest (using md5sum <downloaded-file-name>) and the value on MySQL's website.

3)

Unpack the distribution into the /usr/local/mysql5 directory. The MySQL subdirectories (bin, data, lib, etc.) should be directly under this location.

4)

Create the /etc/my.cnf file with following values (adjust according to site):

Make sure that you change the user parameter and the <hostname> in the file to reflect that of your machine.



[mysqld]
datadir=/usr/local/mysql5/data
#####################################
# Change the value for the following
# variable to the name of the user
# who is installing MySQL
#####################################

user=anoor
lower_case_table_names=1

[mysql.server]
basedir=/usr/local/mysql5


#####################################
# Change the hostname from apollo to
# your machine's hostname

#####################################
log=/usr/local/mysql5/log/apollo.log
log-error=/usr/local/mysql5/log/apollo.err
innodb_data_home_dir = /usr/local/mysql5/ibdata
innodb_log_group_home_dir = /usr/local/mysql5/iblogs
innodb_data_file_path = ibdata1:10M:autoextend
innodb_flush_log_at_trx_commit = 1
set-variable = innodb_buffer_pool_size=5M
set-variable = innodb_additional_mem_pool_size=5M
set-variable = innodb_log_file_size=5M
set-variable = innodb_log_buffer_size=5M
lower_case_table_names=1

[mysqld_safe]
err-log=/usr/local/mysql5/log/mysqld_safe.log
pid-file=/usr/local/mysql5/log/mysqld_safe.pid

5)

Go the the /usr/local/mysql5 directory and run the following command:

./configure

6)

Verify that the mysql daemon is listening on port 3306 using netstat -an | grep 3306

7)

Log into mysql using the mysql command (make sure that the /usr/local/mysql5/bin directory is in your PATH, or specify the full pathname of the mysql executable)

mysql -u root

or

/usr/local/mysql5/bin/mysql -u root



You should a message as follows (where mysql> is the MySQL command prompt):

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 19 to server version: 5.0.15-max



Type 'help;' or '\h' for help. Type '\c' to clear the buffer.



mysql>

8)

Delete the anonymous logins into the database using the following commands:

mysql> delete from mysql.db where host = '%';
mysql> delete from mysql.user where user = '';

9)

Set the root user's password using the following commands:

mysql> update mysql.user set password=password('new-password') where user = 'root';


mysql> flush privileges;

10)

Exit from mysql using quit

11)

Log back into mysql using the mysql -p (supply the password when prompted)

mysql -u root -p

12)

Create the symkey database using:

mysql> create database symkey;

13)

Add the symkey user using:

mysql> grant all on *.* to symkey@localhost identified by 'symkey';

14)

Add the symkey user again, this time using the actual hostname of the machine on which MySQL was installed in place of <hostname>

mysql> grant all on *.* to symkey@<hostname> identified by 'symkey';

15)

Create the xenc database using:

mysql> create database xenc;

16)

Add the xenc user using:

mysql> grant all on *.* to xenc@localhost identified by 'xenc';

17)

Add the xenc user again, this time using the actual hostname of the machine on which MySQL was installed in place of <hostname>

mysql> grant all on *.* to xenc@<hostname> identified by 'xenc';

18)

Exit from mysql using

mysql> quit;

19)

Log back into mysql using the symkey user-name and password (supply the password when prompted)

mysql -u symkey -p symkey

20)

Verify that you are using the symkey database, as the symkey user, by typing the following:

mysql> status;

21)

Exit from mysql using

mysql> quit;

22)

Log back into mysql using the xenc user-name and password (supply the password when prompted)

mysql -u xenc -p xenc

23

Verify that you are using the xenc database, as the xenc user, by typing the following :

mysql> status;

24)

Exit from mysql using

mysql> quit;