MySQL用户权限操作
查看当前用户:
use mysql;
select user,host from user;
或:
SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;
创建用户:(创建一个用户可以从任何主机以密码123456远程访问MySQL)
create user 'root'@'%' identified by '123456';
修改用户(修改指定用户可以从指定主机远程访问MySQL):
update user set host='%' where user='root';
删除用户:
delete from user where user='xxx' and host='xxx'; // root localhost
用户受权:
grant all privileges on *.* to 'root'@'%' identified by '123456';
刷新权限: (该步不能忘记)
FLUSH PRIVILEGES;
作者: Deaseyy
出处: http://www.cnblogs.com/Deaseyy/
新手一枚,请大佬们多多赐教!
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出, 原文链接