mysql 报错: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

#事故现场

mysql执行update操作报错:

  • sql如下:
update psmp.Users set name='Jack' where name='Lily';
  • 报错如下:

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

  • 分析

这是因为MySql运行在 safe-updates模式下,该模式会导致非主键条件下无法执行 update或者 delete命令。
可以通过以下SQL进行状态查询:

show variables like 'SQL_SAFE_UPDATES';

mysql 报错: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,关闭 safe-updates模式:
SET SQL_SAFE_UPDATES = 0;

SET SQL_SAFE_UPDATES = false;
  • 执行下面的sql,打开 safe-updates模式:
SET SQL_SAFE_UPDATES = 1;

SET SQL_SAFE_UPDATES = true;

Original: https://www.cnblogs.com/willingtolove/p/12368712.html
Author: willingtolove
Title: mysql 报错: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

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/8158/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

免费咨询
免费咨询
扫码关注
扫码关注
联系站长

站长Johngo!

大数据和算法重度研究者!

持续产出大数据、算法、LeetCode干货,以及业界好资源!

2022012703491714

微信来撩,免费咨询:xiaozhu_tec

分享本页
返回顶部
最近整理资源【免费获取】:   👉 程序员最新必读书单  | 👏 互联网各方向面试题下载 | ✌️计算机核心资源汇总