码迷,mamicode.com
首页 > 数据库 > 详细

mysql--权限问题

时间:2017-09-05 23:07:38      阅读:300      评论:0      收藏:0      [点我收藏+]

标签:mysql   use   insert   creat   flush   lin   any   sql   ant   

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

mysql--权限问题

标签:mysql   use   insert   creat   flush   lin   any   sql   ant   

原文地址:http://www.cnblogs.com/52forjie/p/7482160.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!