How To Install MySQL 8.0 on RHEL 8


MySQL is a free database management System software most commonly used in three tier applications to store and retrieve records and information.

MySQL was initially developed by MYSQL AB, now owned by Oracle Corporation. It was the primary database application on Linux until MariaDB, a fork of MySQL, came into the picture.

In this article, we will see go through steps on how to Install MySQL 8.0 on RHEL 8.

The steps mentioned in this article will only work if you have enabled RHEL 8 subscription or configured the local yum repository on your system.

Add MySQL Repository

MySQL is now available through the Application Stream (Red Hat Enterprise Linux 8 for x86_64 – AppStream (RPMs)) for RHEL 8. So, you would not need to add an official repository of MySQL to install MySQL server on RHEL 8.

Make sure the AppStream repository is enabled using the following command.

subscription-manager repos --list-enabled


    Available Repositories in /etc/yum.repos.d/redhat.repo
Repo ID:   rhel-8-for-x86_64-baseos-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)
Repo URL:$releasever/x86_64/baseos/os
Enabled:   1

Repo ID:   rhel-8-for-x86_64-appstream-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)
Repo URL:$releasever/x86_64/appstream/os
Enabled:   1

Install MySQL Server

Red Hat offers only MySQL v8.0 on Application Stream repository. Use yum command install the latest version of MySQL.

yum -y install @mysql


Updating Subscription Management repositories.
Last metadata expiration check: 0:08:44 ago on Wed 08 May 2019 12:08:45 PM IST.
Dependencies resolved.
 Package          Arch   Version                            Repository                        Size
Installing group/module packages:
 mysql-server     x86_64 8.0.13-1.module+el8+2558+036183ec  rhel-8-for-x86_64-appstream-rpms  25 M
Installing dependencies:
                  noarch 3.0.7-1.el8                        rhel-8-for-x86_64-appstream-rpms  13 k
 mecab            x86_64 0.996-1.module+el8+2459+7cb96738.9 rhel-8-for-x86_64-appstream-rpms 398 k
 mysql            x86_64 8.0.13-1.module+el8+2558+036183ec  rhel-8-for-x86_64-appstream-rpms 9.2 M
 mysql-errmsg     x86_64 8.0.13-1.module+el8+2558+036183ec  rhel-8-for-x86_64-appstream-rpms 523 k
 protobuf-lite    x86_64 3.5.0-7.el8                        rhel-8-for-x86_64-appstream-rpms 149 k
 mysql-common     x86_64 8.0.13-1.module+el8+2558+036183ec  rhel-8-for-x86_64-appstream-rpms 142 k
Installing module profiles:
Enabling module streams:
 mysql                   8.0

Transaction Summary
Install  7 Packages

Total download size: 36 M
Installed size: 243 M
Downloading Packages:
(1/7): mariadb-connector-c-config-3.0.7-1.el8.noarch.rpm           7.5 kB/s |  13 kB     00:01
(2/7): mecab-0.996-1.module+el8+2459+7cb96738.9.x86_64.rpm         209 kB/s | 398 kB     00:01
(3/7): protobuf-lite-3.5.0-7.el8.x86_64.rpm                        198 kB/s | 149 kB     00:00
(4/7): mysql-errmsg-8.0.13-1.module+el8+2558+036183ec.x86_64.rpm   440 kB/s | 523 kB     00:01
(5/7): mysql-common-8.0.13-1.module+el8+2558+036183ec.x86_64.rpm   220 kB/s | 142 kB     00:00
(6/7): mysql-8.0.13-1.module+el8+2558+036183ec.x86_64.rpm          1.4 MB/s | 9.2 MB     00:06
(7/7): mysql-server-8.0.13-1.module+el8+2558+036183ec.x86_64.rpm   3.4 MB/s |  25 MB     00:07
Total                                                              3.5 MB/s |  36 MB     00:10
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                           1/1
  Installing       : mariadb-connector-c-config-3.0.7-1.el8.noarch                             1/7
  Installing       : mysql-common-8.0.13-1.module+el8+2558+036183ec.x86_64                     2/7
  Installing       : mysql-8.0.13-1.module+el8+2558+036183ec.x86_64                            3/7
  Installing       : mysql-errmsg-8.0.13-1.module+el8+2558+036183ec.x86_64                     4/7
  Installing       : protobuf-lite-3.5.0-7.el8.x86_64                                          5/7
  Installing       : mecab-0.996-1.module+el8+2459+7cb96738.9.x86_64                           6/7
  Running scriptlet: mecab-0.996-1.module+el8+2459+7cb96738.9.x86_64                           6/7
  Running scriptlet: mysql-server-8.0.13-1.module+el8+2558+036183ec.x86_64                     7/7
  Installing       : mysql-server-8.0.13-1.module+el8+2558+036183ec.x86_64                     7/7
  Running scriptlet: mysql-server-8.0.13-1.module+el8+2558+036183ec.x86_64                     7/7
ValueError: File context for /var/log/mysql(/.*)? already defined

  Verifying        : mariadb-connector-c-config-3.0.7-1.el8.noarch                             1/7
  Verifying        : mecab-0.996-1.module+el8+2459+7cb96738.9.x86_64                           2/7
  Verifying        : mysql-8.0.13-1.module+el8+2558+036183ec.x86_64                            3/7
  Verifying        : mysql-errmsg-8.0.13-1.module+el8+2558+036183ec.x86_64                     4/7
  Verifying        : protobuf-lite-3.5.0-7.el8.x86_64                                          5/7
  Verifying        : mysql-server-8.0.13-1.module+el8+2558+036183ec.x86_64                     6/7
  Verifying        : mysql-common-8.0.13-1.module+el8+2558+036183ec.x86_64                     7/7
Installed products updated.



Manage MySQL server Service

After the installation of MySQL, start MySQL server service using the following command.

systemctl start mysqld

Enable MySQL server at system startup.

systemctl enable mysqld

Verify that MySQL server is started using the following command.

systemctl status mysqld


 mysqld.service - MySQL 8.0 database server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2019-05-08 12:15:58 IST; 36s ago
 Main PID: 4269 (mysqld)
    Tasks: 38 (limit: 11530)
   Memory: 485.0M
   CGroup: /system.slice/mysqld.service
           └─4269 /usr/libexec/mysqld --basedir=/usr

May 08 12:15:42 rhel8.itzgeek.local systemd[1]: Starting MySQL 8.0 database server...
May 08 12:15:43 rhel8.itzgeek.local mysql-prepare-db-dir[4186]: Initializing MySQL database
May 08 12:15:58 rhel8.itzgeek.local systemd[1]: Started MySQL 8.0 database server.
Install MySQL 8.0 on RHEL 8 - MySQL Service
Install MySQL 8.0 on RHEL 8 – MySQL Service

Secure MySQL server

In RHEL 8, no password is set for MySQL root user. So, we will run run mysql_secure_installation to secure your MySQL installation by setting the root password, removing anonymous users, disallow root login remotely, etc.



Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No: Y    << Type Y to use VALIDATE PASSWORD COMPONENT to check strength of passwords

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1    << Choose the Level of Strongness
Please set the password for root here.

New password:    << Enter Root Password

Re-enter new password:    << Re-enter Root Password

Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y    << Press Y to set password
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production

Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y    << Press Y to Remove Anonymous User

Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y    << Press Y to Disallow Remote Root Login

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y    << Press Y to Remove test database
 - Dropping test database...

 - Removing privileges on test database...

Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y    << Press Y to Reload Privilege

All done!

Work with MySQL Server

Login to MySQL server as the MySQL root user.

mysql -u root -p


Enter password:    << Enter MySQL Root Password
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.13 Source distribution

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


Install phpMyAdmin

If you are a newbie to MySQL and have less know knowledge on MySQL command line, consider installing phpMyAdmin, an open source web-based management tool to manage MySQL and MariaDB databases.


In tihis article, you have learned how to install MySQL 8.0 on RHEL 8. Please share your feedback in the comments section.

You might also like