mysql访问权限问题_mysql--权限问题

#创建用户

create user 'lin'@'localhost' identified by '123';

#insert,delele,update,select

#级别1:对所有库,下的所有表,下的所有字段

grant select on *.* to 'lin1'@'localhost' identified by '123';

#级别2:对db1库,下的所有表,下的所有字段

grant select on db1.* to 'lin2'@'localhost' identified by '123';

#级别3:对表db1.t1,下的所有字段

grant select on db1.t1 to 'lin3'@'localhost' identified by '123';

#级别4:对表db1.t1,下的id,name字段

grant select (id,name) on db1.t1 to 'lin4'@'localhost' identified by '123';

grant select (id,name),update (name) on db1.t1 to 'lin5'@'localhost' identified by '123';

#修改完权限后,要记得刷新权限

flush privileges;

localhost本地主机, identified by以什么..鉴别

grant 授予,允许. select挑选

create user 'panyu'@'localhost' identified by '123'

创建用户

grant select on *.* to 'pan'@'localhost' identified by '123'

授予pan查看所有库以及所有字段的权限

grant select on db1.* to 'yu'@'localhost' identified by '123';

授予yu查看所有该库下面的所有表的权限

grant select on db1.t1 to 'zhuge'@'loaclhost' identified by '123';

授予zhuge查看db1库,下面t1表里的字段.

grant select (id,name) on db1.t1 to 'guanyu'@'localhost' identified by '123';

grang select (id,name) update(name) on db1.t1 to 'zhangfei'@identified by '123';


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部