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.
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;
Related articles: Getting started with Mariadb – Create Table