How to Install MariaDB 10.1 on Linxu CentOS 7 Server or VPS, VDS

We all know, that MySQL is one of the popular database engines for WordPress, Simple apps and small e-commerce, and other sites. MySQL has many subtypes, for example, you can install clean MySQL on your server, you can install Percona MySQL, MariaDB and also other types.

In this how-to, we will show you how you can install MariaDB 10.1 version on your Linux Centos 7 Server also this can be done on our hosted VPS and VDS.

1. We need to add a repository in your Linux Centos 7

cat <<EOF | sudo tee -a /etc/yum.repos.d/MariaDB.repo
# MariaDB 10.1 CentOS repository list
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF

2. Let's install MariaDB 10.1 using YUM

sudo yum -y install MariaDB-server MariaDB-client

3. Let's enable MariaDB to start when our Linux boots

sudo systemctl start mariadb.service

4. Let's start the MariaDB server

sudo systemctl enable mariadb.service

5. Let's finish the installation and get the root password

sudo /usr/bin/mysql_secure_installation

Once you have executed the above command mentioned in point 5. It will ask you some questions.

  • Enter current password for root (enter for none): Just press the Enter button
  • Set root password? [Y/n]: Y
  • New password: <Enter Your Top Secret pass>
  • Re-enter new password: <Retype your Top Secret pass>
  • Remove anonymous users? [Y/n]: Y
  • Disallow root login remotely? [Y/n]: N
  • Remove test database and access to it? [Y/n]: Y
  • Reload privilege tables now? [Y/n]: Y

Now our installation basic configuration is done and we can start using our MariaDB server.

If you want to login to your MariaDB server using a Linux command line. Just type :

mysql -u root -p

And hit enter, it will ask you for your root password that you specified above.