Navicat 1142 SELECT command denied to user "sx"@"xxx" for table "user" 使用Navicat使用sx用户连接数据库时或者连接为用户sx开放的数据库travel
使用Navicat使用sx用户连接数据库时
或者连接为用户sx开放的数据库travel_agency时
,Navicat窗口弹出上述问题
![](D:云海天随笔pictures avicat 1142.jpg)
具体原因就是该用户(sx)无法读取user表(但注意,应该是Mysql版本改动表名发生了变化,实际上无法读取的是mysql.user
表)
首先检验此时的授权情况
mysql> show grants for sx;
+-------------------------------------------------------------------------+
| Grants for sx@% |
+-------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO "sx"@"%" |
| GRANT ALL PRIVILEGES ON `travel_agency`.* TO "sx"@"%" WITH GRANT OPTioN |
+-------------------------------------------------------------------------+
2 rows in set (0.00 sec)
通过root方式连接数据库,然后通过Navicat让sx用户获得user数据库以及mysql.user表的select权限(仅授权select)
![navicat 1142_2](D:云海天随笔pictures avicat 1142_2.png)
再次查询授权情况
mysql> show grants for sx;
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Grants for sx@% |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO "sx"@"%" |
| GRANT SELECT ON `user`.* TO "sx"@"%" |
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER ON `travel_agency`.* TO "sx"@"%" WITH GRANT OPTION |
| GRANT SELECT ON `mysql`.`user` TO "sx"@"%" |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
4 rows in set (0.00 sec)
当然,也可以在命令行中手动赋权,如GRANT SELECT ON
user.* TO "sx"@"%"
--结束END--
本文标题: Navicat 1142 SELECT command denied to user 'sx'@'xxx' for table 'user' - G
本文链接: https://lsjlt.com/news/7253.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0