How To Install MySQL 5.7 on CentOS/RHEL 8

MySQL is an open-source relational database management system. It is being developed by Oracle Corporation. Its proven reliability, performance, and ease of use. MySQL is an important component of the LAMP and LEMP stacks.

Useful Articles:

In this article, I will explain to you how to install MySQL 5.7 on CentOS/RHEL 8.

Step 1: Add MySQL repository

First, you need to Disable MySQL from the default AppStream repository.

# dnf module disable mysql

Now, add MySQL repositories to your system.

# vim /etc/yum.repos.d/mysql-community.repo

Paste the below data into the MySQL repo file.

name=MySQL 5.7 Community Server

name=MySQL Connectors Community

name=MySQL Tools Community

Step 2: Install MySQL 5.7

Now, the new MySQL repository is available on the system and we are ready to install MySQL 5.7 from the repository.

Disable MySQL 8 repository:

# dnf config-manager --disable mysql80-community

Enable MySQL 5.7 repository:

# dnf config-manager --enable mysql57-community

Now, you are ready to install MySQL 5.7:

# dnf install mysql-community-server

Step 3: Start MySQL Service

Now start MySQL service and enable to start on boot using the below commands.

# systemctl start mysqld.service
# systemctl enable mysqld.service

Step 4: Set Root Password

Before configuring the root user password we need to copy the temporary password for the root user.

# grep 'A temporary password' /var/log/mysqld.log |tail -1

Apply security on MySQL and also set the root user password.

# mysql_secure_installation

Enjoy it!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.