Error Code: 1175. You are using safe update mode

来源:互联网 发布:caffe安装在windows上 编辑:程序博客网 时间:2024/04/29 09:17

如有转载,请注明出处:http://blog.csdn.net/embedded_sky

作者:super_bert@csdn

使用MySQL Workbench执行SQL语句报错,同样的SQL语句在命令行模式下却可以执行成功。

错误代码如下:

19:33:43delete from queuedetail where date_format(create_tm, '%Y%m%d') < date_format(date_sub(curdate(), interval 30 day),'%Y%m%d')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.0.000 sec

google得到如下结论:

MySQL Workbench工具的安全设置中在批量update或delete时,where条件中的字段不是主键,则会提示错误。

解决方案如下:

  • 打开Workbench的菜单[Edit]->[Preferences...]
  • 切换到[SQL Editor]页面
  • [Forbid UPDATE and DELETE statements without a WHERE clause (safe updates)]之前的对勾去掉
  • 点击[OK]按钮
  • 最后一步记得要重启一下Workbench,否则你仍然会得到这个错误提示。
设置见下图(MySQL Workbech 6.2.4.12437)


将上图中的勾去掉,重启MySQL Workbech即可解决。


0 0
原创粉丝点击