Install MySQL 5.7 on CentOS 6 or 7

This section discusses how to to install MySQL 5.7 on CentOS 6 or CentOS 7.

Get MySQL 5.7 for CentOS 7:

As a user with root privileges, enter the following commands in the order shown:

# wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
# yum -y localinstall mysql57-community-release-el7-7.noarch.rpm

Get MySQL 5.7 for CentOS 6:

As a user with root privileges, enter the following commands in the order shown:

#wget http://dev.mysql.com/get/mysql57-community-release-el6-7.noarch.rpm
#yum -y localinstall mysql57-community-release-el6-7.noarch.rpm

Install MySQL 5.7 on CentOS 6 or 7:

Step 1: Enter the following commands in the order shown:

# yum -y install mysql-community-server
# service mysqld start (or) systemctl start mysqld

Step 2: Verify the version using the following command:

# mysql –version

Sample output follows:

mysql Ver 14.14 Distrib 5.7.12, for Linux (x86_64) using EditLine wrapper

Step 3: Enter the following command to get the temporary database root user password:

# grep ‘temporary password’ /var/log/mysqld.log

Step 4: Enter the following command to secure the installation:

# mysql_secure_installation

Follow the prompts on your screen to set a new password and configure other options.