mysql (mariadb) commands useful for WordPress server:

Create a new database:

CREATE OR REPLACE DATABASE db1;

Create a user:

CREATE USER 'foo2'@'localhost' IDENTIFIED BY 'password';

Grant privileges on one specific database:
Database privileges are granted using db_name.* for priv_level, or using just * to use default database. Database privileges include privileges to create tables and functions, as well as privileges for all tables, functions, and procedures in the database. Database privileges are stored in the mysql.db table.

GRANT ALL PRIVILEGES ON  db1.* to 'foo2'@'localhost' WITH GRANT OPTION;
flush privileges;

Change root password:

use mysql;
update user set password=PASSWORD("NewPass") where User='root';

Create a new user:

CREATE USER 'Username'@localhost IDENTIFIED BY 'NewPass';

Give privileges on all databases:

GRANT ALL PRIVILEGES ON *.* TO 'Username'@localhost;

Change password for existing user:

SET PASSWORD FOR 'Username'@localhost = PASSWORD('NewPass');

References:
Mariadb library