Skip to content

Instantly share code, notes, and snippets.

@fabiotatsuo
Last active August 7, 2019 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabiotatsuo/1824d1d3926581fef7ec8538a65c003e to your computer and use it in GitHub Desktop.
Save fabiotatsuo/1824d1d3926581fef7ec8538a65c003e to your computer and use it in GitHub Desktop.
Mysql user commands
List all users
SELECT user, host FROM mysql.user;
Delete user
DROP USER 'user'@'host';
Create user
CREATE USER 'username'@'host' IDENTIFIED WITH mysql_native_password BY 'psswd';
Grant privileges on db
GRANT ALL ON dbname.* TO 'username'@'host';
Show grants
SHOW GRANTS for 'username'@'host';
Session
SHOW PROCESSLIST
Kill session
Kill id
FLUSH PRIVILEGES;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment