MariaDB Setup on Centos and Redhat

How To Install and Configure MariaDB on Centos/RedHat

I want to install MariaDB on Redhat. How do I install MariaDB from command Line?

About MariaDB: It is an open-source database solution.

MariaDB Quick Installation on Centos/Redhat

Step 1: Install MariaDB server and client

sudo yum install mariadb-server mariadb -y

Step 2: Start and enable MariaDB services

sudo systemctl start mariadb
sudo systemctl enable mariadb

Step 3: Check the status of MariaDB service

sudo systemctl status  mariadb

How to Secure MariaDB Installation

Set password for your MySQL instance using the following command. The command will prompt for the current root password, you can hit enter as there is no default password. All the other prompts are self-explanatory.

sudo mysql_secure_installation

How To Login To MariaDB server From CLI

Login using MySQL client terminal using the root password using mysql command.

mysql -u root -p

How To Create a MariaDB User and a Database

Step 1: Create a user named myuser. Replace s3cret with a required strong password.

CREATE USER 'myuser'@'localhost' IDENTIFIED BY 's3cret';

Step 2: Create a db named mydb.


How To Grant Privileges To a MariaDB Database User

Step 1: Grant all privileges on the mydb database to the myuser user.

GRANT ALL PRIVILEGES ON mydb.* TO 'myuser'@'localhost';

Step 2: Flush the privileges and exit the MySQL terminal.

MariaDB Setup on Centos and Redhat

Other Interesting Blogs

Leave a Comment

Share via
Copy link
Powered by Social Snap