Installation of the MariaDB Database Manager on CentOS 7
Installation and Configuration of MariaDB on CentOS
Introduction
MariaDB is a database management system derived from MySQL and licensed under the GPL (General Public License).
CentOS (Community ENTerprise Operating System) is a binary-compatible fork of the Linux distribution Red Hat Enterprise Linux (RHEL), compiled by volunteers from the source code published by Red Hat. The main difference with RHEL is the removal of all references to Red Hat's trademarks and logos.
In this article, we will provide a guide to install this winning combination of MariaDB and CentOS in its latest published version.
Install and Start MariaDB
MariaDB is available in the CentOS repository starting from CentOS 7. Any lower version will require adding the repository additionally to the server. To update the system and install the database server, execute the following command:
yum clean all
yum update -y
yum install -y mariadb-server
With this, we have installed the MariaDB service. Next, run the following commands to start it automatically with the operating system as a system service.
systemctl enable mariadb
systemctl start mariadb
Congratulations, you have installed MariaDB and it is now running for use. If you want to check if it is active, just run the command:
systemctl is-active mariadb
Secure MariaDB
The command to secure MariaDB is executed with the command:
/usr/bin/mysql_secure_installation
It is recommended to include a password and answer positively to all the questions posed by the script. More information on the official MariaDB website.
Using MariaDB
With the default configuration, we can only access the database management system of the server itself from the command line as follows:
mysql -u root -p
Once the requested password is entered, which we defined in the previous step, we can execute \h
to see the list of MariaDB commands. Connected, we can execute the basic commands to create a database, a user, and assign permissions to it, with the following commands:
create database aeiorospruebas;
create user 'aeioros'@'localhost' identified by 'yourpassword';
grant all on aeiorospruebas.* to 'aeioros' identified by 'yourpassword';
Exit the System
We're done for now. To close the session and make the installation operational, just run the command:
exit