MySQL - Create user, database and set permissions
Login in MySQL mysql -u root -p
Create the database:
CREATE DATABASE mydbname;
Create a new user (only with local access) and grant privileges to this user on the new database.
If your stack ships MySQL v8.x:
mysql> create user 'USER_NAME'@'localhost' identified by 'PASSWORD';
mysql> grant all privileges on DATABASE_NAME.* TO 'USER_NAME'@'localhost';
If your stack ships an older version of MySQL:
mysql> grant all privileges on DATABASE_NAME.* TO 'USER_NAME'@'localhost' identified by 'PASSWORD';