MySQL Installation on Centos
1. Configure the server disk arrays. Our mysql standard is:
R1 P1 /
P2 /swap
R10 P1 /mysqldata1
R1 P1 /mysqllogs1
R1 P1 /mysqltemp
This will depend on physical / virtual and number of available disks / size of system.
On a vm environment we typically would split the partitions as above but the disk level Raid configuration would not apply.
2. Download the 64bit mysql rpm files for server and client and copy onto the new centos server:
MySQL-server-<version>.el6.x86_64.rpm
MySQL-client-<version>.el6.x86_64.rpm
3. Type rpm -ivh --replacefiles MySQL-client<version>.el6.x86_64.rpm MySQL-server<version>.el6.x86_64.rpm
Note the --replacefiles flags replaces the 5.1 version that is already installed by default on Centos
This will install the binaries and by default, you'll end up with datafiles in /var/lib/mysql.
4. Create your /mysqldata1/d<instancenumber><instance> folder, /mysqllogs1/d<instancenumber><instance> folder. Change the ownership of these folders to mysql:mysql
5. Copy over /etc/my.cnf from another mysql server and configure appropriately using mysql standards wiki document. Create new section for instance and set file-per-table depending on large or small database.
6. Copy to the clipboard the section for the new instance only (mysqld<instance number>) in my.cnf and paste into a new ini file called mybuild.cnf.
Ensure the section header mysqld<number> has the number removed so it is headed mysqld
7. Run from the command line mysql_install_db --defaults-file=/etc/mybuild.cnf --user=mysql --datadir=/mysqldata1/d<instancenumber>_<instancename>
8. Run from the command line mysqld_multi start <instancenumber> - This will start the new instance
9. Run from the command line mysqld_multi report - This will show if the new instance is successfully running.
10. Log onto the new instance mysql -uroot -P<port number>
11. Copy secure_mysql_install2.sql from the software volume into /scripts and amend the root password for the instance.
12. Secure the installation and set the root password by running from the mysql command line: source /scripts/secure_mysql_install2.sql
13. Create database: create database <database name>
14. Create user for database: grant all on <database>.* to '<database user>'@'%' identified by '<password>';
NOTE:
Installation on Centos 6.6 caused write errors to show in the mysql error log where it could not write the PID file. This was caused by selinux being enabled. Disabling this fixed the issue. See the following article:
selinux
R1 P1 /
P2 /swap
R10 P1 /mysqldata1
R1 P1 /mysqllogs1
R1 P1 /mysqltemp
This will depend on physical / virtual and number of available disks / size of system.
On a vm environment we typically would split the partitions as above but the disk level Raid configuration would not apply.
2. Download the 64bit mysql rpm files for server and client and copy onto the new centos server:
MySQL-server-<version>.el6.x86_64.rpm
MySQL-client-<version>.el6.x86_64.rpm
3. Type rpm -ivh --replacefiles MySQL-client<version>.el6.x86_64.rpm MySQL-server<version>.el6.x86_64.rpm
Note the --replacefiles flags replaces the 5.1 version that is already installed by default on Centos
This will install the binaries and by default, you'll end up with datafiles in /var/lib/mysql.
4. Create your /mysqldata1/d<instancenumber><instance> folder, /mysqllogs1/d<instancenumber><instance> folder. Change the ownership of these folders to mysql:mysql
5. Copy over /etc/my.cnf from another mysql server and configure appropriately using mysql standards wiki document. Create new section for instance and set file-per-table depending on large or small database.
6. Copy to the clipboard the section for the new instance only (mysqld<instance number>) in my.cnf and paste into a new ini file called mybuild.cnf.
Ensure the section header mysqld<number> has the number removed so it is headed mysqld
7. Run from the command line mysql_install_db --defaults-file=/etc/mybuild.cnf --user=mysql --datadir=/mysqldata1/d<instancenumber>_<instancename>
8. Run from the command line mysqld_multi start <instancenumber> - This will start the new instance
9. Run from the command line mysqld_multi report - This will show if the new instance is successfully running.
10. Log onto the new instance mysql -uroot -P<port number>
11. Copy secure_mysql_install2.sql from the software volume into /scripts and amend the root password for the instance.
12. Secure the installation and set the root password by running from the mysql command line: source /scripts/secure_mysql_install2.sql
13. Create database: create database <database name>
14. Create user for database: grant all on <database>.* to '<database user>'@'%' identified by '<password>';
NOTE:
Installation on Centos 6.6 caused write errors to show in the mysql error log where it could not write the PID file. This was caused by selinux being enabled. Disabling this fixed the issue. See the following article:
selinux
Comments