How to Install MariaDB on CentOS.
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.
- CentOS 7
- Login as an administrator on the terminal
- Yum must be configured on the system and is updated.
Installation includes following steps.
1. Add MariaDB Repository
Create a file /etc/yum.repos.d/mariadb.repo and place the following code inside.
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.
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.
We can also enable MariaDB-server at startup by executing the following command.
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.
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.
We can here set the root password which is not set by default. Just fill an easy to remember password and press Enter.
Just Enter ‘y’ in all the choices for the proper configuration of the server.
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.
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 tutoraspire 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.
Execute the following command to stop MariaDB server.
Hence, we have installed and get started with MariaDB on CentOS.