Commands

Enter MariaDB mysql console

sudo mysql

or below command and then root password

mysql -u root -p

List all users of a MariaDB

SELECT user FROM mysql.user;S

List all databases

SHOW DATABASES;

Create new database

CREATE DATABASE databasename;

Create new user and grant access to the database

GRANT ALL ON databasename.* TO 'username'@'localhost' IDENTIFIED BY 'passoword' WITH GRANT OPTION;

Flush Privileges

FLUSH PRIVILEGES;

Exit MariaDB console

EXIT;

Last updated