How to install MariaDB 10.2 in CentOS 7

Share this post to your friends !
  • 1

SystemMen - This article will walk you through how to install MariaDB 10.2 in CentOS 7. MariaDB is an improved version of MySQL. By default, when you install MariaDB in CentOS 7, it will install version 5.5.

Server requirements

Here is the minimum configuration required that I use.

  • OS: CentOS 7.4.1708 (Core) 64 bit.
  • RAM: over 1GB memory.
  • HDD: over 5GB free space. Maybe you need more for store databases.
  • User: root.
  • IP: set static ip, ex:

Added MariaDB repository

First, we will add a MariaDB repository to CentOS 7, which is based on information from the MariaDB home page.

You type the following command. Note that there are no spaces before each line in the command below.

cat > /etc/yum.repos.d/MariaDB.repo <<"EOF"
name = MariaDB
baseurl =

After adding the repository, you may want to update the packages.

yum update -y

Install MariaDB in CentOS 7

Now, type the following command to install MariaDB in CentOS 7.

yum install MariaDB-server MariaDB-client -y
how-to-install-mariadb-10-2-in-centos-7-01 How to install MariaDB 10.2 in CentOS 7
Add repository and install MariaDB 10.2 in CentOS 7.

Installation may take 5 to 10 minutes depending on your internet connection condition.

systemctl enable mariadb
systemctl start mariadb

Interestingly, if you are familiar with CentOS 6. You can still use the command below to check the service and both of these commands work equally.

service mysql status
service mariadb status

Finally, you need to set up the initial security for the MariaDB server using the following command. You will answer some basic questions, set the root password (if not set).


Set rules in Firewalld

If you are installing MariaDB all-in-one then you can skip this step, because MariaDB will use as in LAN. If you want to allow other machines to connect to the MariaDB server on this machine then you need to set up the rule in the Firewalld.

You run the following commands in turn and after each command if the success line appears then you type correctly.

how-to-install-mariadb-10-2-in-centos-7-02 How to install MariaDB 10.2 in CentOS 7
Setup rules in Firewalld for MariaDB’s service.
firewall-cmd --permanent --add-service=mysql
firewall-cmd --permanent --add-port=3306/tcp
firewall-cmd --reload

Check out the MariaDB server

Now you can type the following command to log into the MariaDB server to see how the results. Type root’s password.

mysql -u root -p
how-to-install-mariadb-10-2-in-centos-7-03 How to install MariaDB 10.2 in CentOS 7
Login to MariaDB server.

If you can login to the window as shown in the image above, congratulations on installing MariaDB 10.2 in CentOS 7 successfully. Now you can start creating new databases and use them.

If you liked this article, then please subscribe to our YouTube Channel for more video tutorials. You can also find us on Twitter and Facebook.

Share this post to your friends !
  • 1
If you appreciate what we share in this blog, you can support us by:
  1. Stay connected to: Facebook | Twitter | Google Plus | YouTube
  2. Subscribe email to recieve new posts from us: Sign up now.
  3. Start your own blog with SSD VPS - Free Let's Encrypt SSL ($2.5/month).
  4. Become a Supporter - Make a contribution via PayPal.
  5. Support us by purchasing Ribbon Lite Child theme being using on this website.

We are thankful for your support.

«« »»

Got something to say? Join the discussion

Please keep in mind that all comments are subject to our Comment Policy. Your email address will not be published.
This site uses Akismet to reduce spam. Learn how your comment data is processed.