Install MySQL 5.7 on CentOS 7


It’s better to have installed development tools and disable NetworkManager for a produciton envrionment. You can optionally follow the steps-

Disabling NetworkManager:

systemctl stop NetworkManager
systemctl disable NetworkManager

Install Development Tools:

yum group install "Development Tools"

Remove MariaDB pre-installed libraries-

yum -y remove mariadb-libs

Enable MySQL Repository

First of all, You need to enable MySQL 5.7 community release yum repository on your system. The rpm packages for yum repository configuration are available on MySQL’s official website.

First of all, import the latest MySQL GPG key to your system.

sudo rpm --import

Now, use one of the below commands to configure the Yum repository as per your operating system version.

On CentOS & RHEL 7:

sudo yum localinstall

Installing MySQL 5.7 Server

As you have successfully enabled MySQL yum repository on your system. Now, install MySQL 5.7 community server using the following commands as per your operating system version.

On CentOS & RHEL 7:

sudo yum install mysql-community-server

The above command will install the MySQL community server and other dependencies on your system. During the installation process of packages, a temporary password is created and logged to MySQL log files. Use the following command to find your temporary MySQL password.

After installing RPMs, use the following command to start MySQL Service.

sudo systemctl start mysqld

During the first start, MySQL stores the root account password in log file, That can be found with the followign command.

grep "A temporary password" /var/log/mysqld.log

Now update the default password by running-


You’ll be prompted with a sequence of procedure. You’re done with mysql 5.7 installaiton on a CentOS 7.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.