Skip to content

Instantly share code, notes, and snippets.

@LukeWJensen
Created May 10, 2019 18:00
Show Gist options
  • Save LukeWJensen/321467c437d36fff2f028adb682aa05c to your computer and use it in GitHub Desktop.
Save LukeWJensen/321467c437d36fff2f028adb682aa05c to your computer and use it in GitHub Desktop.
[Mysql Database and User Management] #mysql #database
--CREATE DATABASE
CREATE DATABASE db_name;
--SHOW USERS
SELECT User FROM mysql.user;
--DELETE USERS
DROP USER 'user_name'@'localhost';
--CREATE USER
CREATE USER 'db_user'@'localhost' IDENTIFIED BY 'password123';
--GRANT PRIVILEGES
GRANT ALL ON bd.* TO 'db_user'@'localhost';
--FLUSH PRIVILEGES
FLUSH PRIVILEGES;
--VERIFY USER AND PREV
SELECT User from mysql.user;
SHOW GRANTS FOR 'db_user'@'localhost';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment