当前位置: 移动技术网 > IT编程>数据库>Mysql > mysql 安全模式

mysql 安全模式

2018年03月31日  | 移动技术网IT编程  | 我要评论
今天,执行一条delete语句的时候报错如下: 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 dis ...

今天,执行一条delete语句的时候报错如下:
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 Editor and reconnect.

大意是:数据库运行在safe update 模式,修改表结构的where必须带主键。即非主键条件下无法执行update、delete。

解决方法:
方法一:
临时修改安全模式:SET SQL_SAFE_UPDATES = 0;
再执行update/delete。
恢复安全模式:SET SQL_SAFE_UPDATES = 1;

方法二:
博主使用的是MySQL Workbench,也可以根据提示直接修改默认设置:Preferences -> SQL Editor and reconnect

如您对本文有疑问或者有任何想说的,请 点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网