How to Install MariaDB on CentOS 8

05 September 2020 | Category : CentOS

How to Install MariaDB on CentOS 8

What is MariaDB?

MariaDB is a fork of the popular cross-platform MySQL database management system. MariaDB developed by one of the original developers of MySQL in 2009 after MySQL joined with Oracle (Sun Microsystems). Like MySQL, MariaDB adopted the concept of a Relational Database Management System (RDBMS).

Today, MariaDB is maintained and developed by MariaDB Foundation and the Community contributors with the license under GNU/GPL. And in this article, we want to share with you about How to Install MariaDB on CentOS 8 as a Database Server.

Install MariaDB on CentOS 8

To, install the MariaDB server you don’t need added a repository because by default the MariaDB package is available on the default repository dan you just need run command the installation below :

yum install -y mariadb-server mariadb

After the installation has been successfully, now you need to start the service of the mariadb server and enable the mariadb server on the startup when the server has been booting to start. To do that you can run this command :

systemctl start mariadb
systemctl enable mariadb
Created symlink /etc/systemd/system/mysql.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/mysqld.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/ → /usr/lib/systemd/system/mariadb.service.

To ensure the service has been started, you can check the service status with the command :

systemctl status mariadb

If the service successfully started the output of the above command will show like this :

systemctl status mariadb
? mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mariadb.service.d
           ??limitnofile.conf, migrated-from-my.cnf-settings.conf, tokudb.conf
   Active: active (running) since Fri 2020-09-04 23:45:37 WIB; 2 weeks 5 days ago
 Main PID: 5423 (mysqld)
   Status: "Taking your SQL requests now..."
   CGroup: /system.slice/mariadb.service
           ??5423 /usr/sbin/mysqld

Secure the Installation MariaDB

Next, after the installation successful and the service has been started you need to basic securing the mariadb installation. To secure the installation of mariadb you can run the below command :


The above command will ask to do the configuration like this :


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 authorization.

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]
... 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!

In some configuration it needs a confirmation, Yes or No, so if you choose Yes you can type Y/y and then press Enter to continue. You can follow our above confirmation to make a securing installation of mariadb

Access the MariaDB

In the first time after installation dan securing the installation if you want to access the MariaDB you can run the command :

mysql -u root -p

When you running the above command it will ask a password of user root, then you can type the password of root to accessing the database. And if successful login it will show like this

mysql -u root -p
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 11989915
Server version: 10.3.24-MariaDB-log-cll-lve 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)]>


MariaDB is a fork of the popular cross-platform MySQL database management system. MariaDB replaced MySQL as the default database system on CentOS 8, so when you want to install a database server on CentOS 8 it will install the MariaDB as a database server. In this article, we shared How to Install MariaDB on CentOS 8 with simple step by step.

Share this article :