Skip to content

Instantly share code, notes, and snippets.

@a1exlism
Last active November 30, 2017 13:54
Show Gist options
  • Select an option

  • Save a1exlism/a92459dfd4c92a663910f20e82ebb238 to your computer and use it in GitHub Desktop.

Select an option

Save a1exlism/a92459dfd4c92a663910f20e82ebb238 to your computer and use it in GitHub Desktop.
create user:
CREATE USER 'newuser'@'localhost'
IDENTIFIED BY 'password';
grant privileges:
GRANT ALL PRIVILEGES ON your_database.tables
TO 'newuser'@'localhost';
-- 2in1:
GRANT SELECT ON auth.*
TO 'webauth'@'localhost'
IDENTIFIED BY 'webauth';
-- reload:
FLUSH PRIVILEGES;
-- show privileges:
SHOW GRANTS FOR `webauth`@`localhost`;
-- show all users:
SELECT User, Host, Password FROM mysql.user;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment