How to install MariaDB 10.2 on CentOS 6

Share this post to your friends !
  • 1
    Share

How to install MariaDB 10.2 on CentOS 6
5 (100%) 1 vote[s]

SystemMen - In this article, I will show you how to install MariaDB 10.2 on CentOS 6.

Server requirements

Here are the minimum requirements for the server, I have used a virtual server with such requirements.

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

Added MariaDB repository

The first step is to add MariaDB repository to CentOS 6 server.

You can find more information on how to add a repository here.

Please copy and paste the code below into your terminal. Note that there are no spaces at the beginning of the lines between EOF characters

cat > /etc/yum.repos.d/MariaDB.repo <<"EOF"
# MariaDB 10.2 CentOS repository list - created 2018-03-28 06:30 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.2/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF

After adding the repository, you type below command to update new packages from MariaDB repository.

yum update -y

Install MariaDB in CentOS 6

To install MariaDB server on CentOS 6, type the following command.

yum install MariaDB-server MariaDB-client -y
how-to-install-mariadb-10-2-on-centos-6-01 How to install MariaDB 10.2 on CentOS 6
Install MariaDB 10.2 on CentOS 6.

You wait a while for the installation to complete. Then, type the following two commands to enable the service when you reboot and start the service.

chkconfig mysql on
service mysql start

You can then type the following command to check the mysql service status.

service mysql status

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

mysql_secure_installation

Set rules in IPtables

If you only use MariaDB for the local host, you can skip this section.

If you want to open mysql port 3306 for other servers that can connect to and use the database, then type the following commands.

how-to-install-mariadb-10-2-on-centos-6-02 How to install MariaDB 10.2 on CentOS 6
Set rules to open port 3306 in IPtables.
iptables -I INPUT 1 -m tcp -p tcp --dport 3306 -j ACCEPT
iptables-save > /etc/sysconfig/iptables

And to check the status of the IPtables rule table, you type the command below.

iptables -L

Check MariaDB run

Now on the terminal window, type the following command to login to the mysql service. Remember to type the root password you set.

how-to-install-mariadb-10-2-on-centos-6-03 How to install MariaDB 10.2 on CentOS 6
Login to mysql on CentOS 6.
mysql -u root -p

If your logint succeeds as shown in the image above, you have successfully installed MariaDB 10.2 on CentOS 6. And now you can use the database server.

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