首页 » Linux » CentOS » 查看mysql用户拥有的权限

查看mysql用户拥有的权限

 

查看mysql数据库所有用户的权限

mysql> SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;

+----------------------------+
| query |
+----------------------------+
| User: 'root'@'127.0.0.1'; |
| User: 'demo'@'127.0.0.1'; |
| User: 'root'@'::1'; |
| User: 'root'@'localhost'; |
+----------------------------+
4 rows in set (0.00 sec)

查看mysql数据库中某个用户的权限

mysql> show grants for 'demo'@'127.0.0.1';

+---------------------------------------------------------------------------------------------------------------+
| Grants for demo@127.0.0.1 |
+---------------------------------------------------------------------------------------------------------------+
| GRANT SELECT ON *.* TO 'demo'@'127.0.0.1' IDENTIFIED BY PASSWORD '*183D4A719E6666E5809CFEBC2664C5B7255DB14D' |
+---------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

原文链接:查看mysql用户拥有的权限,转载请注明来源!

1