您的位置:首页 > Web前端

Error Code: 1175. You are using safe update mode and you tried to update a table without a WHERE tha

2015-02-02 10:14 489 查看
在更新或删除数据库中的数据时出现了这种错误: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;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐