You are using safe update mode and you tried to update a table without a WHERE that uses a KEY colum

分手后的思念是犯贱 2022-03-20 15:52 199阅读 0赞

Error: 1175 SQLSTATE: HY000 (ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE)

Message: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column.

Solution

SET SQL_SAFE_UPDATES = 0;

在mysql5中,可以设置safe mode,比如在一个更新语句中
UPDATE table_name SET bDeleted=0;
执行时会错误,报:
You are using safe update mode and you tried to update a table without a WHERE clause that uses a KEY column.”
原因是在safe mode下,要强制安全点,update只能跟where了,
要取消这个限制,可以:
SET SQL_SAFE_UPDATES=0;
即可

发表评论

表情:
评论列表 (有 0 条评论,199人围观)

还没有评论,来说两句吧...

相关阅读