How to Install MySQL 5.7 on Oracle Linux 7

Oracle Linux 7 comes with MySQL yum repository pre-installed. By Default MySQL 8 repository is enabled. You can disable MySQL 8 repository and enable MySQL 5.7 repository to install MySQL 5.7.

You can find enabled repositories with command

Example

Let’s disable MySQL 8 repo and enable MySQL 5.7 repository.

Before you can install MySQL 5.7, if your server has any MySQL 8 related packages installed, you need to uninstall them.

On my server, I had the following packages installed.

These are installed as dependency for the postfix mail server, so if you remove the packages with yum, postfix also get removed, so I removed it with command

–nodeps option will remove packages without removing dependent packages. Make sure you don’t remove the package mysql-release-el7-1.0-5.

Now you can install MySQL server with command

Enable and start MySQL server

To find MySQL initial password, use

Login to MySQL server using the temporary password and set a password

Enter the MySQL server temporary password, then execute the following SQL to change the MySQL root password.

NEW_MYSQL_ROOT_PW – replace with your new secure MySQL root password.

You can secure MySQL installation by running

Need help with Linux Server or WordPress? We can help!

Leave a Reply

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