Infrastructure at your Service

In the following blog, you will learn how to install the latest version of the MariaDB Server 10.5.5 on CentOS 8 and how to use the mariadb user & binaries instead of mysql.

As a reminder, MariaDB Server is highly scalable and can be either used as a Stand Alone, a Master/Slave or a Galera based MariaDB Cluster.
MariaDB Server 10.5.5 was released on 10-Aug-2020 with many new features and some notable changes as the S3 storage engine which allows to archive MariaDB tables in Amazon S3 or the binaries which are now all beginning with mariadb (mariadb-admin, mariadb-dump,…)
It is the very latest release at the time of this writing.


To get our linuxbox up-to-date, it is a good practice to always update the Linux software packages before installing anything new.

[[email protected] ~]# dnf update -y;
Last metadata expiration check: 0:00:44 ago on Tue 11 Aug 2020 11:44:19 AM CEST.
Dependencies resolved.
Package                        Architecture              Version                                  Repository             Size
kernel-4.18.0-193.14.2.el8_2.x86_64 kernel-core-4.18.0-193.14.2.el8_2.x86_64 kernel-modules-4.18.0-193.14.2.el8_2.x86_64 grub2-tools-efi-1:2.02-87.el8_2.x86_64 libzstd-1.4.2-2.el8.x86_64 python3-nftables-1:0.9.3-12.el8.x86_64

dnf-plugin-spacewalk-2.8.5-11.module_el8.1.0+211+ad6c0bc7.noarch python3-dnf-plugin-spacewalk-2.8.5-11.module_el8.1.0+211+ad6c0bc7.noarch python3-newt-0.52.20-9.el8.x86_64 python3-rhn-client-tools-2.8.16-13.module_el8.1.0+211+ad6c0bc7.x86_64


To customize your own MariaDB YUM repository, go on, click on Download, then on the MariaDB Repositories link.
Just choose your distribution and MariaDB Server version. It will then generate the content needed.

You just have to copy and paste it into a file under /etc/yum.repos.d/ called mariadb.repo
[[email protected] yum.repos.d]# vi /etc/yum.repo.d/mariadb.repo
# MariaDB 10.5 [Stable] CentOS repository list - created 2020-08-11 13:57 UTC
[mariadb] name = MariaDB
baseurl =

After the file is in place, we download and cache metadata for all known repos.

[[email protected] ~]#dnf makecache
CentOS-8 - AppStream 9.9 kB/s | 4.3 kB 00:00
CentOS-8 - Base 27 kB/s | 3.9 kB 00:00
CentOS-8 - Extras 10 kB/s | 1.5 kB 00:00


[[email protected] ~]# dnf search MariaDB-server
Last metadata expiration check: 0:11:48 ago on Tue 11 Aug 2020 04:07:47 PM CEST.
================================================= Name Exactly Matched: MariaDB-server =================================================
MariaDB-server.x86_64 : MariaDB: a very fast and robust SQL database server     
================================================= Name & Summary Matched: MariaDB-server =============================================== 
MariaDB-server-debuginfo.x86_64 : Debug information for package MariaDB-server
================================================= Name Matched: MariaDB-server =========================================================
mariadb-server.x86_64 : The MariaDB server and related files
mariadb-server-utils.x86_64 : Non-essential server utilities for MariaDB/MySQL applications
mariadb-server-galera.x86_64 : The configuration files and scripts for galera replication

[[email protected] ~]# dnf install mariadb-server
Verifying        : MariaDB-client-10.5.5-1.el8.x86_64    50/54                                                                                                                                                                                                 
Verifying        : MariaDB-common-10.5.5-1.el8.x86_64    51/54                                                                                                                                                                                                              
Verifying        : MariaDB-server-10.5.5-1.el8.x86_64    52/54                                                                                                                                                                                                              
Verifying        : MariaDB-shared-10.5.5-1.el8.x86_64    53/54                                                                                                                                                                                                             
Verifying        : galera-4-26.4.5-1.el8.x86_64

The installation is successful, we can now enable, start the MariaDB service & check the version

[[email protected] ~]# systemctl enable --now mariadb.service
Created symlink /etc/systemd/system/ → /usr/lib/systemd/system/mariadb.service.
[[email protected] ~]# sudo systemctl start mariadb
[[email protected] ~]# systemctl status mariadb.service
● mariadb.service - MariaDB 10.5.5 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 2020-08-11 16:27:38 CEST; 18s ago
[[email protected] ~]# mariadb -V
mariadb  Ver 15.1 Distrib 10.5.5-MariaDB, for Linux (x86_64) using readline 5.1

We secure now the mariadb instance

[[email protected] ~]# 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
haven't set the root password yet, you should just press enter here.
Enter current password for root (enter for none):
Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.
You already have your root account protected, so you can safely answer 'n'.
Switch to unix_socket authentication [Y/n] n
 ... skipping.
 Remove anonymous users? [Y/n] Y
  ... Success!
Disallow root login remotely? [Y/n] Y
 ... Success!
 Remove test database and access to it? [Y/n] Y
  - Dropping test database...
  ... Success!
  - Removing privileges on test database...
  ... Success!
  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!

We need now a mariadb user and group

[[email protected] ~]# groupadd mariadb
[[email protected] ~]# useradd -d /home/mariadb -m -g mariadb mariadb 
[[email protected] ~]# passwd mariadb

We connect as root to the mariadb instance and create the user mariadb to be OS authentified

[[email protected] ~]$ mariadb
  Welcome to the MariaDB monitor.  Commands end with ; or \g.
  Your MariaDB connection id is 4
  Server version: 10.5.5-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)]> CREATE USER [email protected] IDENTIFIED VIA unix_socket;
  Query OK, 0 rows affected (0.002 sec)
  MariaDB [(none)]> flush privileges;
  Query OK, 0 rows affected (0.000 sec)
  MariaDB [(none)]> select user,host,password from mysql.user;
  | User        | Host      | Password |
  | mariadb.sys | localhost |          |
  | root        | localhost | invalid  |
  | mysql       | localhost | invalid  |
  | mariadb     | localhost |          |

We switch user to mariadb and try the connection

[[email protected] ~]# su - mariadb
Last login: Tue Aug 11 17:19:09 CEST 2020 on pts/0
[[email protected] ~]$ mariadb
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 22
Server version: 10.5.5-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.


As you can see, the installation on CentOS 8 is really fast and easy.
The use of the mariadb user and binaries instead of mysql’s allows to differentiate definitely from MySQL and avoid confusion,
knowing that now it’s 2 different products

Leave a Reply

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

Saïd Mendi
Saïd Mendi

Senior Consultant