下午有安全检查,需要我告诉检查人员数据库中所有用户的权限,百度之后,记录下查询方法做记录,首先查询出数据库里所有的用户:

  1. mysql> select distinct concat(user ,'@',host) as query from mysql.user \G;

  2. *************************** 1. row ***************************

  3. query: [email protected]

  4. *************************** 2. row ***************************

  5. query: root@::1

  6. *************************** 3. row ***************************

  7. query: python@local

  8. *************************** 4. row ***************************

  9. query: python@localhost

  10. *************************** 5. row ***************************

  11. query: qhz@localhost

  12. *************************** 6. row ***************************

  13. query: root@localhost

  14. *************************** 7. row ***************************

  15. query: zabbix@localhost

  16. *************************** 8. row ***************************

  17. query: [email protected]

  18. 8 rows in set (0.00 sec)


  19. ERROR:

  20. No query specified


  21. mysql> select distinct concat(user ,'@',host) as query from mysql.user ;

  22. +----------------------------+

  23. | query                      |

  24. +----------------------------+

  25. | [email protected]             |

  26. | root@::1                   |

  27. | python@local               |

  28. | python@localhost           |

  29. | qhz@localhost              |

  30. | root@localhost             |

  31. | zabbix@localhost           |

  32. | [email protected] |

  33. +----------------------------+

  34. 8 rows in set (0.00 sec)


复制代码
上面内容都是查询到的用户,然后你需要看那个用户的权限,分别来查询下他们的权限,比如我们看看zabbix的权限:
  1. mysql> show grants for zabbix@localhost;

  2. +------------------------------------------------------------------------------------------------------------------------+

  3. | Grants for zabbix@localhost                                                                                            |

  4. +------------------------------------------------------------------------------------------------------------------------+

  5. | GRANT ALL PRIVILEGES ON *.* TO 'zabbix'@'localhost' IDENTIFIED BY PASSWORD '*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9' |

  6. | GRANT ALL PRIVILEGES ON `zabbix`.* TO 'zabbix'@'localhost'                                                             |

  7. +------------------------------------------------------------------------------------------------------------------------+

  8. 2 rows in set (0.00 sec)


复制代码
上面显示的内容就是我们查询到的zabbix在本机的权限
加入你想看其他的用户的权限,可以换其他用户即可