MySQL用户授权

 # 查看用户拥有的权限

select * from mysql.user where user='syj'\G 

 

# 授权的必要条件:需要登录root用户进行授权 # 

# 授权syj所有的权限,但是只能在本地登录数据库操作 

grant all privileges on *.* to 'syj'@'localhost' identified by 'passwd';
flush privileges;

 

# 授权syj所有的权限,允许在192.168.1.1网段内登录操作
grant select on *.* to 'syj'@'192.168.1.%' identified by 'passwd'; 
flush privileges;

 

# 授权syj只有select所有库的权限,但是只能在192.168.1.1网段内登录操作

grant select on *.* to 'syj'@'192.168.1.%' identified by 'passwd';

flush privileges; 

 

#  授权用户报错

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
pastingERROR 1819 (HY000): Your password does not satisfy the current policy requirements
# 解决方法
set global validate_password_policy=LOW;

 

 


posted @ 2018-11-15 17:48  Hello_worlds  阅读(214)  评论(0编辑  收藏  举报