Install MariaDB on CentOS 7

Forked from MySQL, MariaDB has been known to be a drop-in replacement that brings enhancements and performance optimizations over MySQL. This tutorial will show you how to install MariaDB onto CentOS 7 in two different ways.

Step 1: Download/install MariaDB

Install from repository

MariaDB is shipped in the CentOS repo as of CentOS 7. Anything lower will need require you to add the additional repository to your server. Run the following command on your server:

yum update -y
yum install mariadb-server

You may also need to finish the installation by running:

/usr/bin/mysql_secure_installation

This will install MariaDB and walk you through the process of setting up your root password.

Manual install from MariaDB mirror (latest version)

This should be straightforward. You will need to create a file in /etc/yum.repos.d/and add the following:

[mariadb] 
name = MariaDB 
baseurl = http://yum.mariadb.org/10.0/centos7-amd64 
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB 
gpgcheck=1

Once the file is created, run the following commands:

yum update -y
yum install MariaDB-server MariaDB-client

You can then finish the installation by running:

/usr/bin/mysql_secure_installation

If everything was successful, proceed to the next step.

Step 2: Verify that MariaDB is operational

Depending on if you are using the default Vultr image of CentOS 7 or if you are using a Custom ISO, you may need to manually start MariaDB and enable it to start on boot of the server. To do so, run:

systemctl start mariadb.service
systemctl enable mariadb.service

You can check to see if everything is running by executing the following command:

systemctl is-active mariadb.service

After installation, run mysql -u root -p. Enter your password when prompted. You will see output similar to the following:

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is XXXX
Server version: 5.5.X


Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.


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


MariaDB [(none)]> 

Congratulations, you have successfully installed MariaDB on CentOS 7. If you get an error regarding connection, please make sure that MariaDB is running by repeating the beginning of Step 2. Enjoy!

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How To Speed Up Nginx on CentOS?

Introduction This tutorial will teach you how to optimize a website that is being hosted with...

Basics of Managing Users on CentOS Systems

Managing users can be a daunting task: from day-to-day maintenance, security risks, and lack of...

Check Internet Speed With Speedtest-cli on CentOS

Introduction In this tutorial, we'll be installing speedtest-cli to test the network speed of...

Initial Setup of a CentOS 7 Server

Introduction A newly activated CentOS 7 server has to be customized before it can be put into...

ModSecurity and OWASP on CentOS 6 and Apache 2

ModSecurity is a web application layer firewall designed to work with IIS, Apache2 and Nginx. It...

Powered by WHMCompleteSolution