Create a MySQL database and a user

Submitted by Erik Wegner on
Body

The following two commands create a database on a MySQL server and a user with full permissions inside this database.

Connect to your MySQL server:

mysql -uUSERNAME -hSERVERADDRESS -p

Use these two commands:

CREATE DATABASE dbname CHARACTER SET utf8mb4;
GRANT ALL ON dbname.* TO 'username'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
Database name:
User name:
User password:
Allow access from: