Login:

mysql -u root -p

List databases:

MYSQL> SHOW DATABASES; 

Delete database:

MYSQL> DROP DATABASE database.name; 

Make new database:

MYSQL> CREATE DATABASE database.name; 

Make new user:

MYSQL> CREATE USER 'user.name'@localhost IDENTIFIED BY 'password'; 

List users:

MYSQL> SELECT User FROM mysql.user; 

Delete user:

MYSQL> DROP USER user.name@localhost; 

Gives all rights to user over a certain database (replace database.name with * for all databases):

MYSQL> GRANT ALL PRIVILEGES ON database.name .* TO 'user.name'@localhost IDENTIFIED BY 'password';

Refreshes privileges, a must after a change:

MYSQL> FLUSH PRIVILEGES; 

Lists user rights:

MYSQL> SHOW GRANTS FOR 'user.name'@localhost; 

Exports (dumps) the database:

mysqldump -u user.name -p database.name > export.file.name.sql 

Shows original (exported) database name:

head -n 5 export.file.name.sql 

Imports dump of some database to your database:

mysql -u user.name -p database.name < export.file.name.sql