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;

 

相关文章:

  • 2021-09-24
  • 2022-12-23
  • 2021-11-12
  • 2022-12-23
  • 2021-11-12
  • 2021-07-08
  • 2021-12-30
  • 2021-07-18
猜你喜欢
  • 2021-11-01
  • 2021-05-17
  • 2021-12-05
  • 2022-12-23
  • 2021-05-19
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案