October 13, 2024

How to Install and Secure MariaDB 10 in CentOS 7

MariaDb is a free and open source database management software like MySQL. It has been developed by the team who developed the legendary MySQL.

In this tutorial, we will show you how you can install MariaDB on the wide range of environments like RHEL/CentOS and Fedora distributions.

To Install MariaDB follow this step as follows;-

NOTE: All the commands as been run as a root user.

Step #1 – Add MariaDB yum Repository

Add the MariaDB yum repository to MariabDB.repo on your RHEL/CentOS and Fedora distributions

# vi /etc/yum.repos.d/MariaDB.repo 

Now add the following lines on the MariaDB.repo file.

For CentOS 7

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

For RHEL 7

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/rhel7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

After adding the above lines on, your system, save the file on your system.

Step #2: Installing MariaDB on CentOS 7

Once adding the yum repository, you can easily install MariaDB in one command

# yum install MariaDB-server MariaDB-client -y

After that, a text will appear with the total size of MariaDB and Is this ok [y/d/n]. press y to install the MariaDB packages.

Once the package installation completes then star your MariaDB server using the following command

# systemctl start mariadb

systemctl enable mariadb this command means that it will enable MariaDB to start automatically at the next boot

Step #3: Securing MariaDB

initiate the mysql_secure_installation in order to set the root password and disable the remote login and many more..

# mysql_secure_installation

After securing the MariaDB server login into your MariaDB server in order to check if its working or not

# mysql -h localhost -u root -p  // login command
Sample Information

/* Show Databases*/
mysql> show databases;

/* CREATE NEW DATABASE */
mysql> CREATE DATABASE vedant;

In order to check the MariaDB version use the following command:-

# mysql -V 

Vedant Kumar

Currently I'm working as an Implementation Engineer, Started my career as an System Administrator - Linux. Additionally loves to explore new technologies and research about new open-source software that ease the development cycle.

View all posts by Vedant Kumar →

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.

close

Ad Blocker Detected!

VEDANT EXPLAINS
We've noticed that you are using an ad blocker. Advertising helps fund our server cost and keep it truly independent. It helps to build our content creator team. So please disable your ad blocker, and help us to keep providing you with free- great content - for free. Thank you for your support.

Refresh