1. Login to MySQL shell.
2. Run the following command to create database:
CREATE DATABASE 'new_db_name';
And press enter. New database is now created.
3. To create a user we need to run the following command:
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
Press enter. New user is created. The last step is to assign a user to a database.
4. Issue the following command to assign user to a new database with all privileges.
GRANT ALL PRIVILEGES ON new_db_name.* TO 'newuser'@'localhost';
after it, run
FLUSH PRIVILEGES;
to apply privileges.