fbpx
MariaDB

How to install MariaDB 10.3 on CentOS

MariaDB is a community-developed, commercially supported fork of the MySQL relational database management system (RDBMS), intended to remain free and open-source software under the GNU General Public License.

1. Make sure you’re not already running MySQL/MariaDB

Run the following command:
mysql -v

Should output the following:
-bash: mysql: command not found

2. Add the MariaDB 10.3 Repository

Run the following command to add the MariaDB 10.3 repository to yum:
nano /etc/yum.repos.d/maria10-3.repo

Paste the following into the editor:
# MariaDB 10.3 CentOS repository list - created 2018-11-19 23:14 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Save and close the editor, then move to the next step

3. Install MariaDB 10.3 and verify success

Run the following command to install MariaDB 10.3:
yum install MariaDB-server MariaDB-client

Once yum has installed MariaDB, start the MariaDB daemon:
systemctl start mariadb

Then verify that the service has started and the installation is complete:
mysql -v

You should see output similar to the following:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.3.10-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type “quit” to exit, and let’s wrap this up by securing the installation!

4. Securing the Installation

Run the following command
mysql_secure_installation

Now answer the questions that you will be prompted for (the answers I’ve provided are generally what you want to do as well:

Enter current password for root (enter for none):
Set root password? [Y/n] y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y

That’s it! You should now be up and running with a secured installation of MariaDB 10.