Create user and database and grant access

PHOTO EMBED

Fri Jun 11 2021 14:23:59 GMT+0000 (Coordinated Universal Time)

Saved by @dphillips #database #mysql

# If your logged in to mysql (mysql -u root -p) you can create the database
#CREATE DATABASE database_name;
CREATE DATABASE <database> CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci';

# The user can be created with
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'user_password';

# This user also needs access to the database
GRANT ALL PRIVILEGES ON database_name.* TO 'database_user'@'localhost';

# To make the new access rights available you have to reload them
FLUSH PRIVILEGES;

content_copyCOPY