---
title: "mysql grant - 权限授权"
author: "飞奔的熊猫"
date: "2015-01-16T12:04:15Z"
tags: []
categories: ["开源软件"]
slug: "mysql-grant"
draft: false
lastmod: "2015-01-16T12:04:15Z"
id: 2176523
url: "https://runpanda.iteye.com/blog/2176523"
---

【基本介绍】
这里介绍mysql权限授权

【授权情况】
grant 权限 on 数据库对象 to 用户

```linux
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>