使用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

更新数据库中数据时出现: 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 问题的更多相关文章

  1. 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 reconn

    使用MySQL执行update的时候报错:   MySQL     在使用mysql执行update的时候,如果不是用主键当where语句,会报如下错误,使用主键用于where语句中正常. 异常内容: ...

  2. 【MySQL笔记】解除输入的安全模式,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.

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

  3. MySQL错误: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 easonjim

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

  4. mysql 报错: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

    目录 #事故现场 #解决方法 #事故现场 mysql执行update操作报错: sql如下: update psmp.Users set name='Jack' where name='Lily'; ...

  5. Mysql 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

    今天用mysql workbench在更新数据的时候,出现了下面错误:15:52:39    update wp_posts set post_content = replace(post_conte ...

  6. mysql更新字段值提示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

    1 引言 当更新字段缺少where语句时,mysql会提示一下错误代码: Error Code: 1175. You are using safe update mode and you tried ...

  7. Mysql Workbench 执行sql语句删除数据时提示error code 1175

    error code 1175是因为有安全模式限制 执行命令SET SQL_SAFE_UPDATES = 0;之后可以进行操作

  8. rror 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 reconnec

    在mysql5中,可以设置safe mode,比如在一个更新语句中 UPDATE table_name SET bDeleted=0; 执行时会错误,报: You are using safe upd ...

  9. 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 recon

    数据库默认模式是主键不可进行修改操作,所以需要运行以下语句. SET SQL_SAFE_UPDATES = 0;  -- 出现error1175使用.

随机推荐

  1. android中使用图文并茂的按钮

    代码: <LinearLayout android:orientation="horizontal" android:layout_width="match_par ...

  2. Node.js——render封装

    封装 挂在到res上

  3. Sass的的使用一

    sass -v 检测是否安装 Sass 成功 gem update sass 更新 Sass gem uninstall sass 删除/卸载 Sass 的编译有多种方法: 1.命令编译2.GUI工具 ...

  4. 利用ObjectMapper readValue()和泛型解决复杂json结构

    import com.dj.fss.vo.MessageListVO; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; im ...

  5. swift class type isa-swizzling

    class 是引用类型,生成的实例分布在 Heap(堆) 内存区域上,在 Stack(栈)只存放着一个指向堆中实例的指针.因为考虑到引用类型的动态性和 ARC 的原因,class 类型实例需要有一块单 ...

  6. redisd的非持久化配置

    如何关闭redis持久化?我的需求是只把redis当作缓存来用,所以持久化到硬盘对我的需求来说没有意义. 修改redis配置文件,redis.conf 第115行左右. 1.注释掉原来的持久化规则 # ...

  7. Java随机数使用

    JAVA取随机数的三种方式: Math.random() System.currentTimeMillis() random.nextInt() 废话不多说,看代码: /** *取单个随机数 *Mat ...

  8. 网络共享服务器 samba

    之前给自己centos 服务器配置了一下samba网络共享,主要是在windwos上编程,然后方便代码同步到linux上进行编译,现在大概记录一下过程,免得下次又忘记了 首先获取root权限 :su ...

  9. 树莓派2-SSH

    树莓派3系统SSH是默认关闭的, 将SD卡插入linux, 在root 分区, 修改/etc/rc.local 在exit 0前增加一行 /ect/init.d/ssh start 将SD卡插回树莓派 ...

  10. Python之模块和包导入

    Python之模块和包导入 模块导入: 1.创建名称空间,用来存放模块XX.py中定义的名字 2.基于创建的名称空间来执行XX.py. 3.创建名字XX.py指向该名称空间,XX.名字的操作,都是以X ...