Mysql Update更新错误 Error Code:1175

Mysql 5.7,默认执行 update 语句时遇到错误提示:

Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL Editor and reconnect.

 

原因:

默认的安全策略,使得更新时,如果不依靠主键列进行查询时将被提示并失败。

 

解决方式:

SET SQL_SAFE_UPDATES = 0;

关闭掉该方式

 

修改如下:

SET SQL_SAFE_UPDATES = 0;

UPDATE `column` SET `column` = 新值 WHERE 非主键列条件;

SET SQL_SAFE_UPDATES = 1;

 

posted @ 2017-08-31 15:38  试试手气  阅读(778)  评论(0编辑  收藏  举报