在更新或删除数据库中的数据时出现了这种错误: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;
本文详细介绍了如何解决MySQL Safe Updates 模式下无法执行非主键条件下的update命令的问题,提供了两种解决方案:修改数据库模式和使用主键条件执行更新操作。
561

被折叠的 条评论
为什么被折叠?



