#创建用户
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‘;