标签:
MySQL中用户管理可以用多种命令来实现,但是GRANT是一个非常不错而且重要的语句,而且比较方便记忆
1、新建用户:
GRANT ALL PRIVILEGES ON *.* TO ‘user‘@‘localhost‘ IDENTIFIED BY ‘123‘;
2、修改密码:
GRANT ALL PRIVILEGES ON *.* TO ‘user‘@‘localhost‘ IDENTIFIED BY ‘456‘;
3、普通用户修改自己的密码
SET PASSWORD=PASSWORD(‘111‘);
4、增加用户权限
GRANT SELECT,CREATE,ALTER,UPDATE,DELETE ON *.* TO ‘user‘@‘localhost‘;
5、回收用户权限
SHOW GRANTS FOR ‘user‘@‘localhost‘;
6、查看用户权限
SHOW GRANTS FOR ‘user‘@‘localhost‘;
7、查看自己权限
SHOW GRANTS
8、删除用户
DROP USER ‘user‘@‘localhost‘;
标签:
原文地址:http://www.cnblogs.com/xiangshui/p/5196687.html