Installing MySQL
Step 1.) Install MySQL RPMs in the order shown below: Code Block |
---|
| shell> rpm -ivh MySQL-client-5.6.33-1.linux_glibc2.5.x86_64.rpm
shell> rpm -ivh MySQL-shared-5.6.33-1.linux_glibc2.5.x86_64.rpm
shell> rpm -ivh MySQL-devel-5.6.33-1.linux_glibc2.5.x86_64.rpm
shell> rpm -ivh MySQL-server-5.6.33-1.linux_glibc2.5.x86_64.rpm |
Step 2.) Set the MySQL root user password. “server” rpm installation typically displays the following message. - A random password has been set for the MySQL root user.
- You can find the password in "/root/.mysql_secret".
- When you first connect to the server, change the password.
Step 2.1) Start the MySQL server. Code Block |
---|
| shell> /etc/init.d/mysql start |
Step 2.2.) Get the auto-generated password. Code Block |
---|
| shell> cat /root/.mysql_secret |
Step 3.) Connect to MySQL using the auto-generated password from the .mysql_secret file and change the root password using the following commands: Code Block |
---|
| shell> mysql -uroot -p
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('<ANYTHING YOU WANT>');
mysql> SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('<ANYTHING YOU WANT>');
mysql> flush privileges;
mysql> quit |
Info |
---|
| This specific major/minor version of MySQL is required with the root username as specified above. If you have other MySQL installations on the machine we recommend removing them or installing this version on top of them and upgrading their schemas to what is specified. |
Step 4.) Create or modify the my.cnf file as shown below. - Typically the my.cnf file is in /etc/ folder
Code Block |
---|
| shell> vi /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
max_allowed_packet = 150M
max_connections = 600
default-storage-engine=INNODB
character-set-server=utf8
collation-server=utf8_unicode_ci
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
default-storage-engine=INNODB
character-set-server=utf8
collation-server=utf8_unicode_ci
[mysql]
max_allowed_packet = 150M
[mysqldump]
quick
max_allowed_packet = 150M |
Step 5.) Restart MySQL. - Based on the standard MySQL installation, a MySQL script is added to the init.d directory that you can use to Start and Stop the MySQL server.
Code Block |
---|
| shell> /etc/init.d/mysql start
shell> /etc/init.d/mysql stop |
|