mysql数据库执行delete报错

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.
现象:使用工具Workbench执行sql删除数据库中某些数据时,经常报错如下:
错误提示: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.
原因分析:workbench操作mysql数据库时,使用的是安全更新模式,执行delete时必须要禁用安全模式。
解答方法:办法1:SET SQL_SAFE_UPDATES = 0;
办法2:在where判断条件中跟上主键id(例如ID>=0) 例如:delete from mysqldatabase.user where UserName='name' and ID>=0;

参考一下: MySQL删除/更新数据时报1175错误_yhawaii的专栏-CSDN博客 今天删除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 optio https://blog.csdn.net/yhawaii/article/details/7941948