MySQL 8.4 cheatsheet
MySQL 8.4: Databases and users
5 common MySQL 8.4 tasks.
Create a database
Create a database that uses the utf8mb4 character set.
CREATE DATABASE mydb CHARACTER SET utf8mb4;
Drop a database
Delete a database and everything in it.
DROP DATABASE mydb;
Caution: This permanently deletes the database. Take a backup first.
Create a user
Create an account that can connect from the local machine. Use a real password.
CREATE USER 'app'@'localhost' IDENTIFIED BY 'change-me';
Grant privileges on a database
Let a user read and write the tables in one database.
GRANT SELECT, INSERT, UPDATE, DELETE ON mydb.* TO 'app'@'localhost';