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