1. create database
CREATE DATABASE test;
2. create user for database
CREATE USER 'test' IDENTIFIED BY 'password';
3. allow user to login
GRANT USAGE ON *.* TO test@'localhost' IDENTIFIED BY 'password';
4. add full access to database for user
GRANT ALL privileges ON test.* TO test@localhost;
5. propagate the privileges
FLUSH PRIVILEGES;
6. check it
SHOW GRANTS FOR test@localhost;