Skip to content

Instantly share code, notes, and snippets.

@jhaemin
Last active July 27, 2020 11:21
Show Gist options
  • Select an option

  • Save jhaemin/bcf43f611c1e40594caef4e788866562 to your computer and use it in GitHub Desktop.

Select an option

Save jhaemin/bcf43f611c1e40594caef4e788866562 to your computer and use it in GitHub Desktop.
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
FLUSH PRIVILEGES;
GRANT type_of_permission ON database_name.table_name TO 'username'@'localhost';
REVOKE ~ ;
-- ALL PRIVILEGES- as we saw previously, this would allow a MySQL user full access to a designated database (or if no database is selected, global access across the system)
-- CREATE- allows them to create new tables or databases
-- DROP- allows them to them to delete tables or databases
-- DELETE- allows them to delete rows from tables
-- INSERT- allows them to insert rows into tables
-- SELECT- allows them to use the SELECT command to read through databases
-- UPDATE- allow them to update table rows
-- GRANT OPTION- allows them to grant or remove other users’ privileges
DROP USER 'username'@'localhost';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment