Are you looking for a guide to help you install MySQL 5.7 on CentOS 8 / RHEL 8 Linux server / Workstation?. The CentOS / RHEL 8 AppStream repository only contain MySQL 8.0 packages. Not all applications have support for MySQL 8, e.g Jira as of this writing require MySQL 5.7 and below. How then can you install MySQL 5.7 on CentOS 8 / RHEL 8?.
MySQL is a very popular open-source relational database management system. It is being developed by Oracle Corporation – Company behind Oracle Database. With its proven reliability, performance, and ease-of-use, MySQL has become the leading database choice for web-based applications.
Follow the next steps to have a running MySQL 5.7 Server on CentOS 8 / RHEL 8 system.
Step 1: Add MySQL repository
Disable MySQL default AppStream repository:
sudo dnf remove @mysql
sudo dnf module reset mysql && sudo dnf module disable mysql
There is no MySQL repository for EL 8, so we’ll use EL 7 repository instead. Create a new repository file.
sudo vi /etc/yum.repos.d/mysql-community.repo
Paste below data into the file.
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=0
[mysql-connectors-community]
name=MySQL Connectors Community
baseurl=http://repo.mysql.com/yum/mysql-connectors-community/el/7/$basearch/
enabled=1
gpgcheck=0
[mysql-tools-community]
name=MySQL Tools Community
baseurl=http://repo.mysql.com/yum/mysql-tools-community/el/7/$basearch/
enabled=1
gpgcheck=0
Step 2: Install MySQL 5.7 on CentOS 8 / RHEL 8
Once the repository has been added, now install MySQL 5.7 on CentOS 8 / RHEL 8.
Disable MySQL 8 repository:
sudo dnf config-manager --disable mysql80-community
Then enable channel for MySQL 5.7.
sudo dnf config-manager --enable mysql57-community
Then install MySQL 5.7 on CentOS 8 / RHEL 8:
sudo dnf install mysql-community-server
Press y to start the installation.
Last metadata expiration check: 0:02:41 ago on Mon 06 Jan 2020 08:54:52 PM EAT.
Dependencies resolved.
========================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================
Installing:
mysql-community-server x86_64 5.7.28-1.el7 mysql57-community 199 M
Installing dependencies:
ncurses-compat-libs x86_64 6.1-7.20180224.el8 BaseOS 331 k
mysql-community-client x86_64 5.7.28-1.el7 mysql57-community 43 M
mysql-community-common x86_64 5.7.28-1.el7 mysql57-community 311 k
mysql-community-libs x86_64 5.7.28-1.el7 mysql57-community 4.2 M
Transaction Summary
========================================================================================================================================================
Install 5 Packages
Total download size: 247 M
Installed size: 1.0 G
Is this ok [y/N]: y
Check package rpm details to confirm it is 5.7.
rpm -qi mysql-community-server
2.1 – After the installation, start mysqld service.
sudo systemctl enable --now mysqld.service
2.2 – Copy the generated random password for the root user
sudo grep 'A temporary password' /var/log/mysqld.log |tail -1
Take a note of Temp Password by output of above command
2.3 – Start MySQL Secure Installation to change the root password, Disallow root login remotely, remove anonymous users and remove test database.
$ sudo mysql_secure_installation Securing the MySQL server deployment. Enter password for user root:
Authenticate with your generated temporary password. This will ask you to set a new password for the root user.
Change the password for root ? ((Press y|Y for Yes, any other key for No) : Yes
New password:
Re-enter new password:
Estimated strength of the password: 100
Do you wish to continue with the password provided?: Yes
Remove anonymous users?: Yes
Success.
Disallow root login remotely? : Yes
Success.
Remove test database and access to it? : Yes
- Dropping test database...
Success.
- Removing privileges on test database...
Success.
Reload privilege tables now? (Press y|Y for Yes) : Yes
Success.
All done!
2.4 – Now you can access the MySQL.