mysql 安全模式
今天,执行一条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
作者:AmyZYX
出处:http://www.cnblogs.com/amyzhu/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
出处:http://www.cnblogs.com/amyzhu/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。