How to Install MySQL 8.0 on RHEL 8

This is a step-by-step guide on how to install MySQL 8.0 on RHEL 8 server. If you’re new to RHEL 8, you can find all RHEL 8 new features in my previous article Red Hat Enterprise Linux 8 (RHEL 8) New Features & Review. MySQL is a multi-threaded, multi-user SQL database server. It consists of the MySQL server daemon, mysqld, and many client programs.

MySQL 8.0 Enhancements

RHEL 8 is distributed with MySQL 8.0 which has the following new features:

Enhanced JSON functionality.

MySQL 8.0 has support for roles. Roles are collections of privileges.

It incorporates a transactional data dictionary, which stores information about database objects.

Has support for common table expressions – recursive and nonrecursive

Support for window functions, which perform a calculation for each row from a query, using related rows.

It comes with InnoDB which support NOWAIT and SKIP LOCKED options with locking read statements.

Default authentication plug-in

Note that the MySQL 8.0 server distributed with RHEL 8 is configured to use mysql_native_password as the default authentication plug-in because client tools and libraries in RHEL 8 are incompatible with the caching_sha2_password method, which is used by default in the upstream MySQL 8.0 version.

For MariaDB users, I had written an article on installation of MariaDB 10.3 on RHEL 8 below:

Once the service is started, run the command mysql_secure_installation to harden MySQL database server.

mysql_secure_installation
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:
Please set the password for root here.
New password: <ENTER NEW PASSWORD>
Re-enter new password: <CONFIRM 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
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.
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
Success.
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
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
- Dropping test database...
Success.
- Removing privileges on test database...
Success.
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
Success.
All done!