Skip to content

Instantly share code, notes, and snippets.

@madmis
Created March 4, 2016 10:04
Show Gist options
  • Save madmis/028f6e45d949090ac859 to your computer and use it in GitHub Desktop.
Save madmis/028f6e45d949090ac859 to your computer and use it in GitHub Desktop.
Create user
// Show users
select * from mysql.user;
select host, user, password from mysql.user;
// Create user
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
// Grant privileges
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
GRANT LOCK TABLES, ALTER, INSERT, SELECT, UPDATE, CREATE TEMPORARY TABLES, TRIGGER, CREATE VIEW, SHOW VIEW, EXECUTE ON db_.* TO 'newuser'@'localhost';
FLUSH PRIVILEGES;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment