zoukankan      html  css  js  c++  java
  • 更新数据库中数据时出现: 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 问题

    使用workbench在数据库中更新数据时报错: 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(错误及操作见截图)

    1.sql:   update tableName set employee_detailed_status='xx', employee_status_code='xx' where employee_detailed_status='xx'

    2.通过错误提示可以看出:  当前数据库使用的是 safe update mode(安全更新模式),并且在update时where 中没有把主键当做条件。因为在该模式会导致非主键条件下无法执行update或者delete命令,因此会报错。

    3.如何解决这个问题呢?

    第一种方法:

    执行命令SET SQL_SAFE_UPDATES = 0 来修改下数据库模式,这样再去执行update语句或者delete语句即可成功。

    参考地址: https://jingyan.baidu.com/article/6c67b1d6f0efca2787bb1eba.html

    第二种方法:

      (1) 在workbench的菜单栏点击“edit-->Preferences”,然后会弹出对话框“workbench preferences”。

      

      (2) 在“workbench”左边栏点击“SQL Editor”,会看到最后一行是“Safe Updates……”是打钩的,我们只要缺消打钩即可。

           当缺消打钩之后,点击“OK”按钮,linux系统可能会出现“OK”按钮无法点击的情况,请在左边栏点击“General Editors”选项,这样就可以点击“OK”按钮了。

      

      (3) 当上面设置好之后,请重启workbench。

    参考地址: https://jingyan.baidu.com/article/6c67b1d6f0efca2787bb1eba.html

  • 相关阅读:
    SilkTest Q&A 5
    SilkTest Q&A 6
    产生n不同随机数的算法
    根据日期计算星期小算法
    Linux $( )与${ }的区别
    UVA 10313(完全背包变形)
    HDU 4277 USACO ORZ
    Android Studio上手,基于VideoView的本地文件及流媒体播放器
    Mina框架项目运用
    【iOS】怎样推断文本文件的字符编码格式
  • 原文地址:https://www.cnblogs.com/kevliudm/p/9908388.html
Copyright © 2011-2022 走看看