ITeye博客

mysql grant - 权限授权

飞奔的熊猫 · 2015-01-16 12:04 · MySQL · 开源软件 · Markdown

【基本介绍】 这里介绍mysql权限授权

【授权情况】 grant 权限 on 数据库对象 to 用户

grant select on testdb.* to common_user@'%'
grant select on testdb.* to common_user@'192.168.0.%';
grant select, insert, update, delete on testdb.* to common_user@'%'  
grant select on *.* to dba@localhost; -- dba 可以查询 MySQL 中所有数据库中的表。
grant all on *.* to dba@localhost; -- dba 可以管理 MySQL 中的所有数据库

【查看权限】 查看当前用户(自己)权限: show grants;

查看其他 MySQL 用户权限: show grants for dba@localhost;

【回收权限】 revoke 跟 grant 的语法差不多,只需要把关键字 “to” 换成 “from” 即可: grant all on . to dba@localhost; revoke all on . from dba@localhost;

【参考引用】 http://blog.csdn.net/aggrelxf/article/details/6064445

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。