How To Install MariaDB on RHEL 8


MariaDB is one of the most popular open source database management system used by small to large enterprises. It is a fork of famous database server MySQL, developed by MariaDB Corporation Ab, led by original developers of MySQL.

MariaDB is fully compatible with MySQL for ensuring a drop-in replacement capability. MariaDB often used as a database server in LAMP and LEMP stack.

In this post, we will see how to install MariaDB on RHEL 8.

Install MariaDB on RHEL 8

You can obtain MariaDB packages (v10.3) for RHEL 8 from two ways.

Install MariaDB from Red Hat

Installing MariaDB from Red Hat AppStream repository (rhel-8-for-x86_64-appstream-rpms) is a straightforward way, but the repository may have a bit old version of MariaDB package.

yum -y install @mariadb

Install MariaDB from Official MariaDB Mirror

MariaDB foundation offers MariaDB packages for RHEL 8. Packages provided by MariaDB is always fresh and supported by the MariaDB community. Add one of the repository mirrors to the system that MariaDB offers for RHEL 8.

cat <<EOF >> /etc/yum.repos.d/mariadb.repo
name = MariaDB
baseurl =

Install MariaDB server using the following command.

We need to disable the rhel-8-for-x86_64-appstream-rpms repository temporarily to allow yum to download packages from MariaDB mirror.
yum --disablerepo=rhel-8-for-x86_64-appstream-rpms install -y MariaDB-server MariaDB-client

Manage MariaDB Service

In case you want to start/stop the MariaDB service, you can use the following commands.

systemctl start mariadb

systemctl stop mariadb

Verify whether MariaDB is running or not.

systemctl status mariadb
MariaDB Service Status
MariaDB Service Status

Secure MariaDB Installation

Use mysql_secure_installation command to do the initial setup of the MariaDB server. This command is recommended to run in production servers. It removes anonymous user, test database, and disallows remote root login.

Install MariaDB on RHEL 8 - Secure MariaDB Installation
Install MariaDB on RHEL 8 – Secure MariaDB Installation

Access MariaDB

Login into MariaDB server with the below command.

mysql -u root -p
Password required
Access MariaDB
Access MariaDB


That’s All. In this post, you have learned how to install MariaDB on RHEL 8 and do the initial setup. Read Beginner MariaDB Articles to learn more about working with MariaDB.

You might also like