How to get started with MariaDB server on CentOS


Pre requirement: Before we get started with the MariaDB server make sure you have installed the MariaDB server on CentOS and enabled it in systemctl before you proceed to read this article.

Specification:

OS Version: CentOs 8.2 x64

Login to mariadb server:

[root@bluegrid-edu ~]# mysql

Create database:

MariaDB [(none)]> create database edudb;

Create user who’d be accessing your new database:

MariaDB [(none)]> create user [email protected] identified by 'topsecretpassword';

Let’s ensure that our new user “edu” will have all privileges accessing database “edudb”:

Let’s ensure that our new user “edu” will have all privileges accessing database “edudb”:

MariaDB [(none)]> grant all privileges on edudb.* to [email protected];

ALWAYS reload privileges for the changes to take effect:

MariaDB [(none)]> grant all privileges on edudb.* to [email protected];

Now, let’s check if we can log in to MariaDB Server with password topsecretpassword:

  • Logout from current session:
MariaDB [(none)]> quit
  • Login to Mariadb Server:
[root@bluegrid-edu ~]# mysql -uedu -p

Since we have defined that this user has all privileges to database “edudb” only we should be able to see only this database in the list:

MariaDB [(none)]> show databases;
get started with MariaDB | Showing the list of databases in MariaDB server
Showing the list of databases in MariaDB server
Share this post

Share this link via

Or copy link