How To Install MariaDB 10.6 on CentOS 8 / RHEL 8

Posted on 403 views

How can I install MariaDB 10.6 on CentOS 8 / RHEL 8 Linux machine?. MariaDB is a multi-user, multi-threaded SQL database server forked from the MySQL relational database management system. It was designed to be fast, robust and with more advanced features fit for aggressive database operations.

We won’t discuss the cool features of MariaDB 10.6 database system, you can check the release notes for a detailed feature set coverage. Here are just the mere steps required to have a working MariaDB database server on CentOS 8 / RHEL 8 Linux machine.

Install MariaDB 10.6 on CentOS 8 / RHEL 8

These are the ideal steps you’ll go through when installing MariaDB 10.6 on CentOS 8 / RHEL 8 Linux server.

Step 1: Update System

If you don’t have any critical services running in Production on the server, update the system before you begin installation of MariaDB 10.6 on CentOS 8 / RHEL 8.

sudo dnf -y upgrade

Step 2: Add MariaDB 10.6 repository to CentOS 8 / RHEL 8

We now need to add the MariaDB yum repository for our CPU architecture. This guide will cover adding repository for a x86_64 CPU machine.

CentOS 8:

curl -LsS -O
sudo bash mariadb_repo_setup --mariadb-server-version=10.6


curl -LsS -O
sudo bash mariadb_repo_setup --mariadb-server-version=10.6

Expected output from execution:

[info] Checking for script prerequisites.
[info] Repository file successfully written to /etc/yum.repos.d/mariadb.repo
[info] Adding trusted package signing keys...
/etc/pki/rpm-gpg /home/rocky
[info] Successfully added trusted package signing keys
[info] Cleaning package cache...
39 files removed

Step 3: Install MariaDB 10.6 repository to CentOS 8 / RHEL 8

After adding Yum repository, you can proceed to install MariaDB 10.6 repository to CentOS 8 / RHEL 8 straight away.

sudo dnf install boost-program-options -y
sudo dnf module reset mariadb -y
sudo yum install MariaDB-server MariaDB-client MariaDB-backup
sudo systemctl enable --now mariadb

When prompted, press to accept installation:

Dependencies resolved.
 Package                                        Architecture                        Version                                                           Repository                                 Size
 MariaDB-backup                                 x86_64                              10.6.4-1.el8                                                      mariadb-main                              6.9 M
 MariaDB-client                                 x86_64                              10.6.4-1.el8                                                      mariadb-main                               14 M
 MariaDB-server                                 x86_64                              10.6.4-1.el8                                                      mariadb-main                               25 M
Installing dependencies:
 MariaDB-common                                 x86_64                              10.6.4-1.el8                                                      mariadb-main                               88 k
 MariaDB-shared                                 x86_64                              10.6.4-1.el8                                                      mariadb-main                              115 k
 galera-4                                       x86_64                              26.4.9-1.el8                                                      mariadb-main                               13 M
 libaio                                         x86_64                              0.3.112-1.el8                                                     baseos                                     31 k
 libpmem                                        x86_64                              1.6.1-1.el8                                                       appstream                                  78 k
 lsof                                           x86_64                              4.93.2-1.el8                                                      baseos                                    252 k
 perl-DBI                                       x86_64                              1.641-3.module+el8.4.0+509+59a8d9b3                               appstream                                 739 k
 perl-Math-BigInt                               noarch                              1:1.9998.11-7.el8                                                 baseos                                    194 k
 perl-Math-Complex                              noarch                              1.59-419.el8_4.1                                                  baseos                                    108 k
 socat                                          x86_64                                                                         appstream                                 301 k
Enabling module streams:
 perl-DBI                                                                           1.641

Transaction Summary
Install  13 Packages

Total download size: 61 M
Installed size: 285 M
Is this ok [y/N]: y

More details on installed package can be queried using:

$ rpm -qi MariaDB-server
Name        : MariaDB-server
Version     : 10.6.4
Release     : 1.el8
Architecture: x86_64
Install Date: Tue Oct 19 11:18:33 2021
Group       : Applications/Databases
Size        : 122991191
License     : GPLv2
Signature   : DSA/SHA1, Wed Aug  4 18:54:11 2021, Key ID cbcb082a1bb943db
Source RPM  : MariaDB-server-10.6.4-1.el8.src.rpm
Build Date  : Tue Aug  3 16:00:25 2021
Build Host  : rhel8-amd64
Relocations : (not relocatable)
Vendor      : MariaDB Foundation
URL         :
Summary     : MariaDB: a very fast and robust SQL database server
Description :
MariaDB: a very fast and robust SQL database server

It is GPL v2 licensed, which means you can use the it free of charge under the
conditions of the GNU General Public License Version 2 (

MariaDB documentation can be found at
MariaDB bug reports should be submitted through

Start and enable MariaDB service

sudo systemctl enable --now mariadb

Status should show as running:

$ systemctl status mariadb
● mariadb.service - MariaDB 10.6.4 database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
   Active: active (running) since Tue 2021-10-19 11:19:36 UTC; 6s ago
     Docs: man:mariadbd(8)
  Process: 737887 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
  Process: 737861 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POS>
  Process: 737859 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
 Main PID: 737871 (mariadbd)
   Status: "Taking your SQL requests now..."
    Tasks: 15 (limit: 49496)
   Memory: 68.0M
   CGroup: /system.slice/mariadb.service
           └─737871 /usr/sbin/mariadbd

Step 4: Secure MariaDB Database Server

Now that MariaDB is installed on CentOS 8 / RHEL 8, secure it by running mysql_secure_installation.

$ sudo mariadb-secure-installation


In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB 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? [Y/n] 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? [Y/n] y
 ... Success!

By default, MariaDB 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? [Y/n] 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? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Test access to database shell:

$ mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 19
Server version: 10.6.4-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

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

MariaDB [(none)]> SELECT version();
| version()       |
| 10.6.4-MariaDB  |
1 row in set (0.000 sec)

MariaDB [(none)]> QUIT



Gravatar Image
A systems engineer with excellent skills in systems administration, cloud computing, systems deployment, virtualization, containers, and a certified ethical hacker.