How To : MySQL Basic Management

  Linux
  1. First login to your mysql database via root :
mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 18
Server version: 10.3.13-MariaDB

MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]>

2. Use below commands to create database and create user that have access to the databases

create database [database name];
grant all on [database user].* to '[database name]'@'%' identified by '[database user password]';
flush privileges;
quit;

Please change [database name] , [database user] and [database user password] accordingly to your needs‌.

3. Finally to test, login as the new user and use command :

show databases;

4. It is working if the output shows the new database.