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;