Skip to content

Instantly share code, notes, and snippets.

@haio
Last active December 11, 2015 18:19
Show Gist options
  • Save haio/4640413 to your computer and use it in GitHub Desktop.
Save haio/4640413 to your computer and use it in GitHub Desktop.
mysql 权限控制
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'rootpasswd' WITH MAX_CONNECTIONS_PER_HOUR 5;
GRANT ALL PRIVILEGES ON *.* TO 'username'@'1.1.0.123' IDENTIFIED BY 'rootpasswd' MAX_CONNECTIONS_PER_HOUR 5;
GRANT SELECT ON dbname.* to 'username'@'%' IDENTIFIED BY by 'iamwangnc';
FLUSH PRIVILEGES;
select * from mysql.user;
REVOKE ALL PRIVILEGES ON *.* TO 'root'@'%';
delete from mysql.user where Host='%';
FLUSH PRIVILEGES;
文档:
http://dev.mysql.com/doc/refman/5.1/zh/database-administration.html#user-names
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment