在更新或删除数据库中的数据时出现了这种错误: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 Queries and reconnect.
例如:update statistic set country = 'unknown' where country = 'NO';
原因:MySql运行在safe-updates模式下,该模式会导致非主键条件下无法执行update或者delete命令,也就是说where后面的条件不是主键
解决办法:
1.执行命令SET SQL_SAFE_UPDATES = 0;修改数据库模式,再执行之前的update语句;
2.可以带一个主键条件:update statistic set country = 'unknown' where country = 'NO' and id >= 0;