## Table of Contents
– [Install MariaDB on CentOS 7](#install-mariadb-on-centos-7
– [Install MariaDB](#install-mariadb
– [Secure MariaDB Server](#secure-mariadb-server
– [Test the Installation](#test-the-installation
In this guide, we are going to explain to you how to install MariaDB on CentOS 7 and some additional recommended steps that you must take to increase the usability and security of your server.
[MariaDB](https://mariadb.org/ is one of the most popular database servers in the world. It is commonly installed as a part of the LEMP stack. It is an open-source database management system, developed by the MySQL developers as a replacement for MySQL. So, if you want MySQL installation for reference, follow our guide, [How to Install MySQL on CentOS 7](https://systemongrid.com/support/guides/how-to-install-mysql-on-centos-7. Between MySQL and MariaDB, [MariaDB is the preferable package and can work better](https://mariadb.com/kb/en/library/mariadb-vs-mysql-compatibility/.
Before installing MariaDB, you should have access to the CentOS 7 server and created a non-root user account with sudo privileges by following our guide, [Initial server setup with CentOS 7](https://systemongrid.com/support/guides/initial-server-setup-with-centos-7.
## Install MariaDB on CentOS 7
## Install MariaDB
Install MariaDB packages using the below command. Press “Y” when you are asked to confirm the installation.
$ sudo yum install mariadb-server
After the installation is done, start the MariaDB server using the below command.
$ sudo systemctl start mariadb
Now, check the status of the MariaDB server to make sure you have done the installation successfully.
$ sudo systemctl status mariadb
In the above output, you can clearly see that the MariaDB service is active and running.
Now, check if the MariaDB is starting at boot. You can do it by using the below command.
$ sudo systemctl enable mariadb
## Secure MariaDB Server
Now, it is time for you to secure the MariaDB server.
MariaDB uses a security script to modify the default security options like remote logins. Use the below command to run the security script.
$ sudo mysql_secure_installation
Then, you will be asked to enter the root password, which hasn’t set yet so you can hit the ENTER button.
After this, you will be asked to set a password for the root account. Enter “Y” if you want to set a password. After entering “Y”, you will need to enter a password and confirm it by re-entering the password.
If you don’t want to set a password for the root, you can also skip the above step by pressing the ENTER button. But, it is highly recommended to set a strong password for the root.
Then, you will be asked if you want to remove anonymous users. Press Y for yes, or any other key to continue. (We recommend accepting all the below security suggestions by entering “Y” in each step.
Then, you will be asked if you want to disallow root login remotely. Press Y for yes, or any other key to continue.
Then, you will be asked to remove the test database and reload privilege tables. Press Y for yes, or any other key to continue.
Finally, you will get the following output.
## Test the Installation
You can test your installation and know the information about it. For that, you need to connect to your MariaDB server as a root user (or, a user with password authentication using the below command.
$ mysqladmin -u root -p version
The above output shows that the MariaDB installation has been successful.
In this guide, you have learned how to install MariaDB on CentOS 7 and some additional steps that must be taken to increase the usability and security of your server.