查看mysql所有用户的权限 mysql用户 mysql权限
kevin.Zhu 发布于:2013-1-16 12:36 分类:Mysql 有 13 人浏览,获得评论 0 条
http://world77.blog.51cto.com/414605/1350236
-
mysql> select distinct concat(user ,'@',host) as query from mysql.user \G;
-
*************************** 1. row ***************************
-
query: root@127.0.0.1
-
*************************** 2. row ***************************
-
query: root@::1
-
*************************** 3. row ***************************
-
query: python@local
-
*************************** 4. row ***************************
-
query: python@localhost
-
*************************** 5. row ***************************
-
query: qhz@localhost
-
*************************** 6. row ***************************
-
query: root@localhost
-
*************************** 7. row ***************************
-
query: zabbix@localhost
-
*************************** 8. row ***************************
-
query: root@localhost.localdomain
-
8 rows in set (0.00 sec)
-
-
ERROR:
-
No query specified
-
-
mysql> select distinct concat(user ,'@',host) as query from mysql.user ;
-
+----------------------------+
-
| query |
-
+----------------------------+
-
| root@127.0.0.1 |
-
| root@::1 |
-
| python@local |
-
| python@localhost |
-
| qhz@localhost |
-
| root@localhost |
-
| zabbix@localhost |
-
| root@localhost.localdomain |
-
+----------------------------+
-
8 rows in set (0.00 sec)
-
复制代码
上面内容都是查询到的用户,然后你需要看那个用户的权限,分别来查询下他们的权限,比如我们看看zabbix的权限:
-
mysql> show grants for zabbix@localhost;
-
+------------------------------------------------------------------------------------------------------------------------+
-
| Grants for zabbix@localhost |
-
+------------------------------------------------------------------------------------------------------------------------+
-
| GRANT ALL PRIVILEGES ON *.* TO 'zabbix'@'localhost' IDENTIFIED BY PASSWORD '*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9' |
-
| GRANT ALL PRIVILEGES ON `zabbix`.* TO 'zabbix'@'localhost' |
-
+------------------------------------------------------------------------------------------------------------------------+
-
2 rows in set (0.00 sec)
-
复制代码
上面显示的内容就是我们查询到的zabbix在本机的权限
加入你想看其他的用户的权限,可以换其他用户即可