Views: 169
1 0
Read Time:2 Minute, 24 Second

MariaDB server is a community developed fork of MySQL server. Started by core members of the original MySQL team, MariaDB is designed as a drop-in replacement of MySQL(R) with more features, new storage engines, fewer bugs, and better performance.
MariaDB can be an better choice for choice for database professionals looking for a robust, scalable, and reliable SQL server.

In this tutorial, we will explain how to install the latest version of MariaDB on a CentOS 7 / RHEL 7 server.

Step 1: Add MariaDB Yum Repository

– Create a new repo file /etc/yum.repos.d/mariadb.repo and add the below code changing the base url according to the operating system version and architecture.

# nano /etc/yum.repos.d/mariadb.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/centos73-amd64/
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

name = MariaDB baseurl = http://yum.mariadb.org/10.3/centos73-amd64/ gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1

Step 2 – Install MariaDB Server

– Let’s use the following command to install MariaDB 10.3 .

# yum install MariaDB-server MariaDB-client

– Once the installation is complete, we’ll enable and start the daemon with the following commands:

# systemctl enable mariadb
# systemctl start mariadb

Step 3 – Secure MariaDB Install

– Once install is complete, Run Command mysql_secure_installation

The script will prompt you to determine which actions to perform.

# mysql_secure_installation 

More customisation official documents link

Step 4 – Working with MariaDB

– Once the configuration is complete, connect to MariaDB server using the following command.

# mysql -u root -p
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 16
Server version: 10.3.2-MariaDB MariaDB Server
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>

– Let’s create a new database

## CREATE DATABASE
MariaDB [(none)]> CREATE DATABASE Test_db;

– Create a database user account

## CREATE USER ACCOUNT
MariaDB [(none)]> CREATE USER 'dbuser'@'localhost' IDENTIFIED BY 'Password';

– Grant permissions on the database “Test_db” for the new user “dbuser”, the bellow command allows the user “dbuser” to read, edit, execute and perform all tasks across the database “Test_db”.

## GRANT PERMISSIONS ON DATABASE
MariaDB [(none)]> GRANT ALL ON Test_db.* TO 'dbuser'@'localhost';

– Once you have grant the permissions that you want to set up for your new users, make sure to reload all the privileges using the following command:

## RELOAD PRIVILEGES
MariaDB [(none)]> FLUSH PRIVILEGES;

We hope this tutorial was enough Helpful. If you need more information, or have any questions, just comment below and we will be glad to assist you!