2020-02-21权限

具体权限

https://images2018.cnblogs.com/blog/1479220/201809/1479220-20180911160815293-907297832.png

建议

https://images2018.cnblogs.com/blog/1479220/201809/1479220-20180911155738298-211843872.png

操作

查看用户的权限
show grants for brian@'localhost';
 
用户授权(两种方法)
1、创建用户然后授权
创建用户
help create user;
create user brian@'localhost' identified by '123456';
# 授权
help grant;
所有权限库的所有表
create user brian@'localhost' identified by '123456';
grant all on briandata.* to brian@'localhost';
 
2、一条命令授权
grant all on briandata.* to brian@'localhost' identified by '123456';
 
根据网段和IP进行授权
grant all on briandata.* to brian@'192.168.10.%' identified by '123456';
grant all on briandata.* to brian@'192.168.10.0/255.255.255.0' identified by '123456';
 
 
回收权限(revoke)
revoke insert on briandata.* from 'brian'@'localhost';
 
# 查看用户的权限(对应的权限会变成Y)
select * from mysql.user\G;

你可能感兴趣的:(2020-02-21权限)