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';

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值