下午有安全检查,需要我告诉检查人员数据库中所有用户的权限,百度之后,记录下查询方法做记录,首先查询出数据库里所有的用户:
-
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)
-
-
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)
-
加入你想看其他的用户的权限,可以换其他用户即可
本文转自你是路人甲还是霍元甲博客51CTO博客,原文链接http://blog.51cto.com/world77/1350236如需转载请自行联系原作者
world77