How to Install MariaDB on CentOS.

Introduction

MariaDB is an open source database management system. MariaDB intends to maintain high compatibility with MySQL. It is one of the most popular databases in the world. MariaDB is named after the name of younger daughter Maria of its founder Michael "Monty" Widenius. In this tutorial, we will learn the steps involved in the installation process of MariaDB on CentOS.

Prerequisites

  • CentOS 7
  • Login as an administrator on the terminal
  • Yum must be configured on the system and is updated.

Installation

Installation includes following steps.

1. Add MariaDB Repository

Create a file /etc/yum.repos.d/mariadb.repo and place the following code inside.

CentOS How to Install MariaDB on CentOS

2. Install MariaDB-server

Since MariaDB repository has been added to the yum package installer hence now we can install MariaDB-server by executing just one simple command given below.

CentOS How to Install MariaDB on CentOS1 CentOS How to Install MariaDB on CentOS2 CentOS How to Install MariaDB on CentOS3 CentOS How to Install MariaDB on CentOS4 CentOS How to Install MariaDB on CentOS5

3. Start MariaDB-server

Now, MariaDB server has been installed. We need to start the server in order to access MariaDB shell on the terminal. Execute the following command for this purpose.

CentOS How to Install MariaDB on CentOS6

We can also enable MariaDB-server at startup by executing the following command.

CentOS How to Install MariaDB on CentOS7

Now, if we check the status of the service then we get MariaDB activated on the system and enabled on the startup as the command's output shown below.

CentOS How to Install MariaDB on CentOS8

4. Server Configuration

Run mysql_secure_installation on the terminal to configure the MariaDB-server. This prompts the user to enter the password for the user root. We can just hit Enter since we are installing it at the very first time.

CentOS How to Install MariaDB on CentOS9

We can here set the root password which is not set by default. Just fill an easy to remember password and press Enter.

CentOS How to Install MariaDB on CentOS10

Just Enter 'y' in all the choices for the proper configuration of the server.

CentOS How to Install MariaDB on CentOS11 CentOS How to Install MariaDB on CentOS12

Now, we are all done to access MariaDB shell on terminal and execute queries.

5. Access MariaDB shell on terminal

Execute the following command to access MariaDB shell on the terminal.

This will prompt to fill the password for user root. Just Enter the Password which we have just set. Press Enter to proceed.

CentOS How to Install MariaDB on CentOS13

Now, an interface is opened which is called MariaDB monitor (or shell). Here we can execute our database related queries. I have created a database named as javatpoint by executing the following query.

We can also list our created databases by just typing show databases; on the shell. This will show all the databases exists on the server.

CentOS How to Install MariaDB on CentOS14

Execute the following command to stop MariaDB server.

CentOS How to Install MariaDB on CentOS15

Hence, we have installed and get started with MariaDB on CentOS.






Latest Courses