How to install MariaDB 10.2 in CentOS 7

by Daniel Pham
Published: Updated:

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

(This is an article from my old blog that has been inactive for a long time, I don’t want to throw it away so I will keep it and hope it helps someone).

0 0 votes
Article Rating

You may also like

Notify of
Inline Feedbacks
View all comments

DevOps Lite is a personal blog specializing in technology with main topics about DevOps, DevSecOps, SRE and System Administrator. Articles are shared for free and contributed to the community.



Subscribe my Newsletter for new blog posts. Stay updated from your inbox!

© 2021-2024 – All rights reserved.

Please write sources “” when using articles from this website.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Would love your thoughts, please comment.x

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.