> ## Content Index
> Fetch the complete content index at: https://scriptcrunch.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# How To Install and Configure MariaDB on Centos/RedHat
- URL: https://scriptcrunch.com/install-configure-mariadb-centos-redhat/
- Published: 2019-07-12T14:48:02.000Z
- Updated: 2026-06-23T08:56:08.000Z
- Author: Scriptcrunch Editorial
- Tags: Databases, #Migrated-1758801465347, #wp, #wp-post, #Import 2025-09-25 11:57

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

**About MariaDB**: It is an open-source [database](https://scriptcrunch.com/tag/databases/) 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.

```
CREATE DATABASE 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.

```
FLUSH PRIVILEGES;
exit
```