How to Install MariaDB on CentOS 7

How to Install MariaDB on CentOS 7

 

We will show you how to install MariaDB on CentOS 7. MariaDB is a community-developed fork of MySQL. MariaDB is a free and open source database software, widely used ranging from websites to banking software. It is an improved, drop-in replacement for MySQL. It is one of the most popular database servers in the world, developed after the acquisition of MySQL by Oracle Inc. to sta free and open source. Installing MariaDB on CentOS 7, is an easy task, just carefully follow the steps of this tutorial and should have MariaDB installed on CentOS 7, in less then 10 minutes. Let’s get started!

1. Login via SSH and update the system

To install MariaDB on your CentOS 7 server you need to have a full root access to the server. Full root SSH access is included with all our Linux VPS hosting plans. Before you continue with the instructions below, connect to your server via SSH and make sure your system software is up to date.

yum update

2. Install MariaDB on CentOS 7

It became very easy to install MariaDB on the latest CentOS release. To install MariaDB on your CentOS 7 VPS, run the following command:

yum install mariadb-server

The installer with ask you to confirm the MariaDB installation. Just type y and press Enter.

The installation will take few seconds depending on the connection speed and server performance.

3. Manage MariaDB on CentOS 7

Once the installation is completed it is good to know how you can manage the MariaDB service. To start the MariaDB service, run the following command on the terminal:

systemctl start mariadb

To stop the MariaDB service, you can use the following command:

systemctl stop mariadb

To restart the service, you can run the following command:

systemctl restart mariadb

To check the status of the MariaDB service, run the following command:

systemctl status mariadb

4. Enable MariaDB on system boot

To enable the MariaDB service on system boot, run the following command:

systemctl enable mariadb

In case you want MariaDB disabled on system boot, run the following command:

systemctl disable mariadb

5. Secure MariaDB on CentOS 7

Once you install the MariaDB database server on your CentOs 7 VPS, it is recommend to harden the security of the service. A good starting point is to run the security hardening script, shipped with the MariaDB service. To run the script, you can use the following command:

mysql_secure_installation

The MariaDB security script will address few security concerns that comes by default with the MariaDB installation as well as will allow you to set up root password for the MariaDB service. This root password is different than the root password you are using for connecting to the server via SSH. You will use this password to connect to the MariaDB server as root so you can manage the MariaDB users, databases, privileges and more.

To connect to the MariaDB server as root through the command line, you can use the following command:

mysql -u root -p

Then, type the MariaDB root password which you have set during the initial MariaDB service security hardening.

 

Original Article