MySQL执行delete报错:Error Code: 1175

delete from T1 where C1 in (xxx, xxx)

执行以上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_SAFE_UPDATES = ON 的时候,非主键条件下无法执行update/delete

 

解决:

查状态,如果是ON,把状态改成OFF

show variables like 'SQL_SAFE_UPDATES'
set SQL_SAFE_UPDATES = OFF

posted @ 2020-01-06 16:29  F_Ichigo  阅读(373)  评论(0编辑  收藏  举报