grant命令的基本格式

1 grant 权限 on 数据库对象 to 用户

实例一:在任意ip地址登陆的common_user用户可以对testdb数据库里的数据进行查询操作、插入操作、更新操作、删除操作

1 grant select on testdb.* to common_user@'%'//有查询数据的权限
2 grant insert on testdb.* to common_user@'%'//有出入数据的权限
3 grant update on testdb.* to common_user@'%'//有更新数据的权限
4 grant delete on testdb.* to common_user@'%'//有删除数据的权限

以上命令等价以下命令。

grant select,insert,update,delete on testdb.* to common_user@'%'

实例二:在ip为192.168.0.1到192.168.0.255之间登陆的developer用户可以对testdb数据库里的表进行创建、修改、删除操作

1 grant create on testdb.* to developer@'192.168.0.%';//有创建表的权限
2 grant alter  on testdb.* to developer@'192.168.0.%';//有修改表的权限
3 grant drop   on testdb.* to developer@'192.168.0.%';//有删除表的权限

 

参考网址:http://www.cnblogs.com/hcbin/archive/2010/04/23/1718379.html

 

相关文章:

  • 2021-10-24
  • 2022-12-23
  • 2022-12-23
  • 2021-11-02
  • 2021-11-23
  • 2021-11-28
猜你喜欢
  • 2022-02-21
  • 2021-06-14
  • 2021-06-30
相关资源
相似解决方案