How to Install MariaDB on CentOS 7 on Server?


As divided from MySQL, MariaDB has been known for the drop-in replacement which brings enhancements and performance optimizations over the MySQL. In this article, we will explain how to install MariaDB on CentOS 7 in two different manners:


1)Downloading and installing MariaDB


Install from repository


MariaDB is being shipped in the CentOS repo as of CentOS 7. Anything lower will have to require to add the additional repository to your server. Run the below-mentioned command on your server:


yum update -y

yum install mariadb-server


You should also require finishing the installation by running:


/usr/bin/mysql_secure_installation


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


Manual installation from MariaDB mirror, it is the latest version


This has to be straightforward and you have to create a file in /etc/yum.repos.d/and include 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 has been created, you need to run the below mentioned commands:


yum update -y

yum install MariaDB-server MariaDB-client


You can then finalize the installation by running the below command:


/usr/bin/mysql_secure_installation


2) You need to Verify that MariaDB is in operational


It depends if you are using the default HostingRaja image of CentOS 7 or if you are utilizing a Custom ISO, you have to manually begin MariaDB and enable it to start on the boot of the server. To do so, run the below command:


systemctl start mariadb.service

systemctl enable mariadb.service


You will be able to check if everything is running by including the below command:


systemctl is-active mariadb.service


After the installation, you need to run mysql -u root -p. Enter the password when it is been prompted. You will notice the output similar to the below-mentioned following:


Welcome to the MariaDB monitor.  Commands end with ; or \g.

Your MariaDB connection id is xxxxxxxxx

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)]>


Finally, you have successfully installed MariaDB on CentOS 7 on a cloud server. If you are facing any error regarding the connection, you need to make sure that MariaDB is running by repeating the initial of Step2.