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 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. 0.000 sec

2 方案

SET SQL_SAFE_UPDATES = 0;
update 表名 set 字段1 = 字段2+1;
SET SQL_SAFE_UPDATES = 1;

3 总结

这篇文章仅作为记录使用。  

原文地址:https://www.cnblogs.com/fanbi/p/8408951.html

时间: 2024-11-10 07:24:31

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的相关文章

mysql错误:you are using update mode and you tried to update a table without a where that uses a key column to disable safe mode

you are using update mode and you tried to update a table without a where that uses a key column to disable safe mode 您使用的是更新模式,并且您尝试更新一个没有在使用一个键列的表禁用安全模式 是因为 MySQL Workbench中 安全设置,执行的SQL语句是进行批量更新或者删除的时候就会提示这个错误. 解决方法: 打开菜单[Edit] -> Preferences... 对勾

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_content, '/water', '')    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 disabl

mysql update 报 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

UPDATE i18nresource SET languageId = 'en-us' 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. 

mysql查询字段值为数字

原文:mysql查询字段值为数字 我想查询字段值为数字的sql如下:select * from tj_item_result where tj_value REGEXP '^[0-9]'

MySQL判断字段值来确定是否插入新记录

今天正好有个新需求,要求在一张表中,保证不插入重复的记录. 即,保证每条记录中的某个字段的值不重复. 下面是我给出的SQL语句: // 判断表中现有字段3的值是否与新插入记录的字段3的值相同,如果不同则插入新数据. INSERT INTO 表名称 (字段1, 字段2, 字段3) SELECT 插入值1, 插入值2, 插入值3 FROM DUAL WHERE NOT EXISTS ( SELECT * FROM 表名称 WHERE 表名称.字段3 = 插入值3) 如果 "表.校验字段"

mongo 更新字段值,若不存在则自动创建

查询语句 db.getCollection("A表").update( {  "id":{$eq:11} } ,{     $set:{"a":1}  } , {multi: true} ) 作用:根据条件来更新A表中a字段的值,若a字段不存在则创建. ------------------------------- 查询语句分析 条件:"id":{$eq:11}   id=11 更新:$set:{"a":1

Oracle两表关联(join)更新字段值一张表到另一张表

[采用视图更新的方式] 有需求A表,B表,需要将B表中的name字段更新到A表中的name,两表有id关联,代码如下: update  (select a.name aname, b.name bname from A a, B b where a.id = b.id) set aname = bname; --注:两表关联属性id必须为unique index或primary key

MySQL更新的几个异常记录

>>Error Code: 1045. Access denied for user 'test'@'%' (using password: YES) 使用MySQL的select * into outfile ‘/tmp/rs.txt’ from tb_name来导出结果时遇到这个问题, 当前用户虽然拥有全部权限,但是file权限需要单独赋予,使用root用户执行: grant file on *.* to [email protected]; >>Error Code: 109

mysql错误:Error Code: 1175. You are using safe update mode and you tried to update a table……

今天遇到一个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. 网上查了一下,原来是SET SQL_SAFE_UPDATES