mysql 版本5.17.21, 新建用户aa,授权查询权限。aa可以登录mysql,但不能做任何操作,提示如下错误。(test用户有管理员权限,都是正常的。)查询数据库show databases :mysql> show databases; ERROR 2006 (HY000): MySQL server has gone away No connection. Trying to reconnect... Connection id: 12 Current database: *** NONE ***
+---------------------------------------------------+
| Grants for aahttps://bbs.deepin.org/user/72751 |
+---------------------------------------------------+
| GRANT USAGE ON *.* TO 'aa'@'localhost' |
| GRANT SELECT ON `world`.* TO 'aa'@'localhost' |
+---------------------------------------------------+
2 rows in set (0.00 sec)
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id: 12
Current database: *** NONE ***
ERROR 1184 (08S01): Aborted connection 12 to db: 'unconnected' user: 'aa' host: 'localhost' (init_connect command failed)
系统查询的用户表信息:
select host,user,authentication_string from mysql.user;
+-----------+------------------+-------------------------------------------+
| host | user | authentication_string |
+-----------+------------------+-------------------------------------------+
| localhost | root | *2BB8BBF7ECAFF5898BAFFB2AC93FF039F8B1445F |
| localhost | mysql.session | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| localhost | mysql.sys | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| localhost | debian-sys-maint | *2BB8BBF7ECAFF5898BAFFB2AC93FF039F8B1445F |
| % | test | *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 |
| localhost | aa | *3F6489C2293B20876945D05FC2638EBBFAECF275 |
+-----------+------------------+-------------------------------------------+
6 rows in set (0.00 sec)
授权查询
mysql> show grants for aa@'localhost';
+---------------------------------------------------+
| Grants for aahttps://bbs.deepin.org/user/72751 |
+---------------------------------------------------+
| GRANT USAGE ON *.* TO 'aa'@'localhost' |
| GRANT SELECT ON `world`.* TO 'aa'@'localhost' |
+---------------------------------------------------+
2 rows in set (0.00 sec)