ERROR 1143 (42000): SELECT command denied to user
来源:互联网 发布:37轩辕剑剑气进阶数据 编辑:程序博客网 时间:2024/06/01 08:40
同事要update MySQL UAT 环境的基础数据表,发出了这样的授权申请语句。觉得没什么问题,也就给批准了。
你能看出这个授权语句有什么问题吗?e1534 这个用户已经存在,并且可以连接上这个库。
GRANT INSERT, UPDATE ,DELETE ON `adm`.`t_code` TO'e1534'@'192.80.176.100';
但他在更新的时候报了如下错误:
mysql> update t_code set name='b' where id =1;
ERROR 1143 (42000): SELECT command denied to user'e1534'@'192.80.176.100' for column 'id' in table 't_code'
为什么呢,因为他在update语句中用到了where条件,但它申请的授权语句中却没有对这张的select权限。
在mysql中如果只申请了对表的update,delete权限的时候,那么在update和delete的语句中就不能出现where子句,否则就会遇到上述错误。
如果只有对表的update权限是可以进行全表更新的,但这样的操作在生产环境几乎是不被允许的(特殊情况除外).
mysql> update t_code set name='b' ;
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0
要解决这个问题,还要给update的表,授予select的权限。
mysql>GRANT SELECT ON `adm`.`t_code` TO 'e1534'@'192.80.176.100';
所以在给MySQL 用户授权的时候,不但要检查授权的语句是否正确,还要看要执行的sql到底需要什么权限。而不是单独审核。
- ERROR 1143 (42000): SELECT command denied to user
- SELECT command denied to user
- ERROR 1142 (42000) at line 6688: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for t
- mysqldump: Got error: 1142: SELECT, LOCK TABLES command denied to user 'root'@'localhost' for table
- 关于 hibernate SELECT command denied to user 的一种处理
- mysql "select command denied to user root" 问题解决
- ERROR 1142 CREATE command denied to user 'root'@'xxxxx
- mysql 5.5 中mysqldump: Got error: 1142: SELECT,LOCK TABL command denied to user 'root'@'localhost' fo
- ERROR 1142 (42000): UPDATE command denied to user 'test'@'192.168.1.101' for table 'employees'
- ERROR 1370 (42000): execute command denied to user backupAccount@'localhost' for routine 'databaseNa
- ERROR 1142 (42000): INSERT command denied to user 'radius'@'localhost' for table 'radcheck'
- execute command denied to user...
- com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: SELECT command denied to user’
- com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: SELECT command denied to user 'xxxx'@''
- mysql SELECT command denied to user 'root'@'localhost' for table 'XXX' 报错1142
- java.sql.SQLException: SELECT command denied to user 'wzhpingsheng'@'127.0.0.1' for table 'table_adm
- mysql SELECT/UPDATE command denied to user 'root'@'localhost' for table 'XXX' 报错1142处理
- INSERT command denied to user 上线后
- 毕业生答辩 六月份你就知道用处了
- LeetCode:Unique Paths
- hdu1281(二分匹配+构图)
- kinect2.0 之摄像头
- Linux下安装tomcat
- ERROR 1143 (42000): SELECT command denied to user
- QT5.0.1在Windows下 出现QApplication: No such file or directory 问题的解决办法
- 烦恼也是一种幸福
- 鸟哥的私房菜笔记之基础命令
- GOOD 自定义EL表达式方法
- Dom4j解析XML时要用到jaxen的jar包
- C++中exe传参数给另外一个exe
- v4l2 编程接口 — ioctl
- Byte和Bit之间的转换