使用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. js 和 java 将时间倒计时显示

    需求:用户购买产品,创建了一个订单,但是还么有支付,此时给用户三十分钟剩余支付时间,前台页面做倒计时功能,时间到达时,更改订单状态 ,输出的格式是:29:23 java 实现 package com. ...

  2. js获取select选中的标签option的值

      js中获取方法 var obj = document.getElementByIdx_xx_x(”testSelect”); //定位id var index = obj.selectedInde ...

  3. SQL——时间戳

    mysql 低版本,date.datetime.timestamp 无法精确到毫秒 可以舍弃时间类型字段,用 bigint 来代替,如果用字符串类型代替,还是比较担心排序的时候只是根据第一个字母进行排 ...

  4. Winform之GDI绘制验证码

    主要功能:点击验证码可更换,输入验证码进行登陆 需要导入命名空间System.Drawing; 产生五位的随机字符串: 1 Random random = new Random(); //产生5个随机 ...

  5. js 动态添加表单 table tr

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  6. cksum - 一个文件的检查和以及字节数

    SYNOPSIS(总览) ../src/cksum [OPTION]... [FILE]... DESCRIPTION(描述) 输出CRC(循环冗余校验码)检查和以及每个FILE的字节数. --hel ...

  7. 获取当前时间(日期格式) && 获取当前加一年的时间(日期格式)

    获取当前时间,日期格式function currentDate() { var date = new Date(); var y = date.getFullYear(); var m = date. ...

  8. React开发实时聊天招聘工具 -第四章 Redux

    复杂以后 setState 就不太方便了 所以使用Redux来管理 React只负责View. Store.State.Dispatch.Reducer reducer(state,action) { ...

  9. Oracle排名函数(Rank)实例详解

    这篇文章主要介绍了Oracle排名函数(Rank)实例详解,需要的朋友可以参考下     --已知:两种排名方式(分区和不分区):使用和不使用partition --两种计算方式(连续,不连续),对应 ...

  10. Layui表格之多列合并展示

    前言: 当我们在使用Layui的时候,有时表格中的列比较多,展示出来肯定是有问题的,这样就不得不舍弃一些列不展示,不展示是一种解决方案,但是更好的解决方案应该是合并展示. 这里的展示不是合并单元格,合 ...