Create a Database and a User with Full Privileges

Create a database named database_name and enter your root database password
mysql -u root -p -e "CREATE DATABASE database_name CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci";

Login to MySQL as root
mysql -u root -p

Create a user called database_name_user and grant all privileges

CREATE USER database_name_user@localhost IDENTIFIED BY 'password_of_user';
GRANT ALL PRIVILEGES ON database_name.* TO 'database_name_user'@'localhost' IDENTIFIED BY 'password_of_user';
FLUSH PRIVILEGES;
\q

Category

Sys