MySQL Installation on RHEL
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 Redhat server:
MySQL-server--<version>.el7.x86_64.rpm
MySQL-client-<version>.el7.x86_64.rpm
3. Before install check for any different versions of MySQL rpm installed , If it is then that should be removed
rpm -qa |grep mysql
eg. rpm -ev --nodeps mysql-community-libs-compat-5.7.19-1.el7.x86_64 ( this is just an example but follow the list to remove all the rpm displayed by the above command)
Remove mysql directory from /var/lib and subsequent log files with in /var/log eg. /var/log/mysqld.log
4. Type rpm -ivh MySQL-client<version>.el7.x86_64.rpm MySQL-server<version>.el7.x86_64.rpm
This will install the binaries and by default, you'll end up with datafiles in /var/lib/mysql.
5. Create your /mysqldata1/d<instancenumber><instance> folder, /mysqllogs1/d<instancenumber><instance> folder. Change the ownership of these folders to mysql:mysql
6. 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.
7. 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
8. Run from the command line mysql_install_db --defaults-file=/etc/mybuild.cnf --user=mysql --datadir=/mysqldata1/d<instancenumber>_<instancename>
9. Run from the command line mysqld_multi start <instancenumber> - This will start the new instance
10. Run from the command line mysqld_multi report - This will show if the new instance is successfully running.
11. Log onto the new instance mysql -uroot -P<port number>
12. Copy secure_mysql_install2.sql from the software volume into /scripts and amend the root password for the instance.
13. Secure the installation and set the root password by running from the mysql command line: source /scripts/secure_mysql_install2.sql
14. Create database: create database <database name>
15. Create user for database: grant all on <database>.* to '<database user>'@'%' identified by '<password>';
Note : In case if we have root password issue then carry out the below steps
mysql -u root
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('xxxxxxxxx');
or
mysqladmin -u root password xxxxxx ( space between u root )
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 Redhat server:
MySQL-server--<version>.el7.x86_64.rpm
MySQL-client-<version>.el7.x86_64.rpm
3. Before install check for any different versions of MySQL rpm installed , If it is then that should be removed
rpm -qa |grep mysql
eg. rpm -ev --nodeps mysql-community-libs-compat-5.7.19-1.el7.x86_64 ( this is just an example but follow the list to remove all the rpm displayed by the above command)
Remove mysql directory from /var/lib and subsequent log files with in /var/log eg. /var/log/mysqld.log
4. Type rpm -ivh MySQL-client<version>.el7.x86_64.rpm MySQL-server<version>.el7.x86_64.rpm
This will install the binaries and by default, you'll end up with datafiles in /var/lib/mysql.
5. Create your /mysqldata1/d<instancenumber><instance> folder, /mysqllogs1/d<instancenumber><instance> folder. Change the ownership of these folders to mysql:mysql
6. 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.
7. 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
8. Run from the command line mysql_install_db --defaults-file=/etc/mybuild.cnf --user=mysql --datadir=/mysqldata1/d<instancenumber>_<instancename>
9. Run from the command line mysqld_multi start <instancenumber> - This will start the new instance
10. Run from the command line mysqld_multi report - This will show if the new instance is successfully running.
11. Log onto the new instance mysql -uroot -P<port number>
12. Copy secure_mysql_install2.sql from the software volume into /scripts and amend the root password for the instance.
13. Secure the installation and set the root password by running from the mysql command line: source /scripts/secure_mysql_install2.sql
14. Create database: create database <database name>
15. Create user for database: grant all on <database>.* to '<database user>'@'%' identified by '<password>';
Note : In case if we have root password issue then carry out the below steps
mysql -u root
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('xxxxxxxxx');
or
mysqladmin -u root password xxxxxx ( space between u root )
Comments