Install MariaDB 10.4 on CentOS 8


This guide will take you through how to install MariaDB 10.4 on CentOS 8 system. As of this writing, MariaDB 10.4 is the current stable (GA) series of MariaDB. You can read more about MariaDB 10.4 features.

Install MariaDB 10.4 on CentOS 8

Install MariaDB 10.4 YUM Repository

The default CentOS 8 AppStream repo contains MariadDB 10.3. To install MariaDB 10.4, you need to install its YUM repository.

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

Next, install MariaDB YUM repository signing key.

rpm --import

Update your system

dnf update

Install MariaDB 10.4

To install MariaDB 10.4 from the repos created above, you need to disable to AppStream repos which provides MariaDB 10.3 packages.

yum --disablerepo=AppStream install MariaDB-server MariaDB-client
Dependencies resolved.
 Package                               Arch                          Version                                      Repository                      Size
 MariaDB-client                        x86_64                        10.4.8-1.el8                                 mariadb                         12 M
 MariaDB-server                        x86_64                        10.4.8-1.el8                                 mariadb                         26 M
Installing dependencies:
 MariaDB-common                        x86_64                        10.4.8-1.el8                                 mariadb                         87 k
 galera-4                              x86_64                        26.4.2-1.rhel8.0.el8                         mariadb                         13 M

Transaction Summary
Install  4 Packages

Total download size: 51 M
Installed size: 196 M
Is this ok [y/N]:y

During the installation, two privileged MariaDB 10.4 user accounts are created.

  • One is [email protected], it has no password, but you need to be system ‘root’ user to connect e.g sudo mysql
  • The other is [email protected], it has no password either, but you need to be the system ‘mysql’ user to connect.

Running MariaDB

To start MariaDB;

systemctl start mariadb

To enable MariaDB to run on system boot;

systemctl enable mariadb

To check the status of MariaDB;

systemctl status mariadb
● mariadb.service - MariaDB 10.4.8 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 Thu 2019-10-03 16:08:26 EDT; 1min 45s ago
     Docs: man:mysqld(8)
 Main PID: 10019 (mysqld)
   Status: "Taking your SQL requests now..."
    Tasks: 30 (limit: 11521)
   Memory: 101.9M
   CGroup: /system.slice/mariadb.service
           └─10019 /usr/sbin/mysqld

Verify the MariaDB installed version.

mysql -V
mysql  Ver 15.1 Distrib 10.4.8-MariaDB, for Linux (x86_64) using readline 5.1

Securing MariaDB

MariaDB comes with a default security script, mysql_secure_installation that is used to improve the security of MariaDB installation by:

  • Setting the password for root accounts.
  • Removing root accounts that are accessible from outside the local host.
  • Removing anonymous-user accounts.
  • Removing the test database, which by default can be accessed by anonymous users.

Simply run the command below to launch the script.


MariaDB 10.4 Authentication

As stated above, two secure accounts are created during the installation of MariaDB 10.4. The [email protected] uses both the unix_socket and the mysql_native_password authentication plugins.

Unix_socket plugins works when connection to MariaDB is made from the localhost as a root user. You can simply login running the command (as root or with sudo);

mysql -u root

The mysql_native_password plugin is used as a failover for the unix_socket plugin. However, the account has an invalid password. To enable password authentication, you need to login to MariaDB as root user as shown above and set the password.

set password = password("[email protected]");

This re-enables the MariaDB password authentication.

Set Native Password Authentication Method as Default

If you need to change the unix_socket plugin authentication to the msqyl_native_password authentication method, simply login to MariaDB and change the authentication plugin for root user.

ALTER USER [email protected] IDENTIFIED VIA mysql_native_password USING PASSWORD("MyPQQSSword");

Next time you try to login without specifying the password, login will fail.

sudo mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

Read more about authentications on MariaDB 10.4 Authentication.

That is all on our guide on how to install MariaDB 10.4.

You can check our other guides on MariaDB/MySQL installations by following the links below;

Install MariaDB 10 on Debian 10 Buster

Install MariaDB 10.4 on Ubuntu 18.04/Debian 9

Install MariaDB 10.3 on CentOS 7

Install MariaDB 10.3 on Fedora 30

Install MySQL 8 on CentOS 8

Install MySQL 8 on Debian 10 Buster


Please enter your comment!
Please enter your name here