A quick reference guide for creating databases, users, and managing privileges in MariaDB or MySQL.
CREATE DATABASE mydb;Replace
mydbwith your preferred database name.
CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypassword';Replace
myuserandmypasswordwith your desired username and password.
GRANT ALL PRIVILEGES ON mydb.* TO 'myuser'@'%';
FLUSH PRIVILEGES;Grants full control of the database
mydbto the usermyuser.
SELECT User, Host FROM mysql.user;Useful for verifying that your new user was created successfully.
STATUS;Displays server version, connection info, and other useful details.
Simple and clean setup commands for initializing a MariaDB / MySQL environment.