Skip to content

Instantly share code, notes, and snippets.

@seanhsu0102
Last active January 27, 2016 10:18
Show Gist options
  • Save seanhsu0102/e3ff548517f4a531ead5 to your computer and use it in GitHub Desktop.
Save seanhsu0102/e3ff548517f4a531ead5 to your computer and use it in GitHub Desktop.
MySQL add User (Grant)
GRANT ALL ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE ON db_name.* TO 'username'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'username'@'127.0.0.%' IDENTIFIED BY 'password' WITH GRANT OPTION;
GRANT REPLICATION SLAVE ON *.* TO repl@"192.168.1.%" IDENTIFIED BY 'password';
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE ON db_name.* TO 'username'@'%' IDENTIFIED BY 'password';
GRANT SELECT, LOCK TABLES ON *.* TO ‘backup’@’localhost’
IDENTIFIED BY ‘backup_password’; # mysqldump
GRANT SELECT ON *.* TO ‘backup’@’localhost’
IDENTIFIED BY ‘backup_password’; # mysqldump
FLUSH PRIVILEGES;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment