How to Install MySQL 8.0 on CentOS 8 / RHEL 8

MySQL is the most popular, free and open-source relational database management platform, which is used to host multiple databases on any single server by allowing multi-user access to each database.

The latest MySQL 8.0 version is available to install from the default AppStream repository using the MySQL module that is enabled by default on the CentOS 8 and RHEL 8 systems.

There is also MariaDB 10.3 database version is available to install from the default AppStream repository, which is “drop-in replacement” for MySQL 5.7, with some restrictions. If your application is not supported with MySQL 8.0, then I recommend you to install MariaDB 10.3.

In this article, we will walk through you the process of installing the latest MySQL 8.0 version on CentOS 8 and RHEL 8 using the default AppStream repository via YUM utility.

Note: The instructions provided in this article will only work if you have enabled the Red Hat subscription on RHEL 8.

Install MySQL 8.0 on CentOS8 and RHEL 8

The latest version of the MySQL 8.0 is available to install from the default Application Stream repository on CentOS 8 and RHEL 8 systems using the following yum command.

# yum -y install @mysql

The @mysql module will install the most recent version of MySQL with all dependencies.

Install MySQL on CentOS 8 Using AppStream

Install MySQL on CentOS 8 Using AppStream

Once the installation of MySQL completes, start the MySQL service, enable it to automatically start at system boot and verify the status by running the following commands.

# systemctl start mysqld
# systemctl enable --now mysqld
# systemctl status mysqld
Manage MySQL Service in CentOS 8

Manage MySQL Service in CentOS 8

Now secure the MySQL installation by running the security script that carries several security-based operations such as setting the root password, removing anonymous users, disallow root login remotely, remove test database and reload privilege.

# mysql_secure_installation
Secure MySQL Installation in CentOS 8

Secure MySQL Installation in CentOS 8

Once MySQL installation is secured, you can log in to the MySQL shell, and start creating new databases and users.

# mysql -u root -p
mysql> create database tecmint;
mysql> GRANT ALL ON tecmint.* TO [email protected] IDENTIFIED BY 'ravi123';
mysql> exit

That’s all! In this article, we’ve explained how to install MySQL 8.0 on CentOS 8 and RHEL 8. If you have any questions or feedback, do share it with us in the comment section below.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Anusha Saive

Anusha worked for many years in the IT industry as a Project Manager, and also a senior writer and editor at Tecmint. She is a huge fan of Linux and is passionate about writing Linux and technology related stuff. Follow Her On: Facebook and Instagram

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

Got something to say? Join the discussion.

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.