MySQL、You are using safe update mode
MySQL默认模式是sql_safe_updates=1的。在这个模式下不管你是update还是delete一行where 条件都要指定主键。如果where条件只出现的不是主键就会出错。
例子:
set sql_safe_updates =1;--开始安全更新、这个是我这个例子的前提。
--第一步:建立两个表
create table t(x int,y int);
create table t2(x int primary key,y int);
--第二步:向表中插入数据
insert into t(x,y) values(1,1),(2,2),(3,3);
insert into t2(x,y) values(1,1),(2,2),(3,3);
--第三步:测试安全更新模式对update delete 的影响。
update t set y =100 where x=1;--这个会出报错、You are using safe update mode......
update t2 set y=100 where x=1;--这个就没有事。因为x这表t2中是主键、而在表t中不是。
--解决方案:
为了对t表的更新也可以完成、我们就要在update 语句前加上一句。
set sql_safe_updates =0;--禁用这个模式就可以了。
MySQL、You are using safe update mode的更多相关文章
- MySQL错误:You are using safe update mode and you tried to update a table without a WHERE that uses a K
转载自:http://blog.csdn.net/dragonpeng2008/article/details/7279590 Error: 1175 SQLSTATE: HY000 (ER_UPDA ...
- 【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 ...
- 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 ...
- Mysql报错Error Code: 1175. You are using safe update
使用MySQL执行update的时候报错:Error Code: 1175. You are using safe update mode and you tried to update a tabl ...
- mysql update时报错You are using safe update mode
在使用mysql执行update的时候,如果不是用主键当where语句,会报如下错误,使用主键用于where语句中正常. ) Error Code: . You are using safe upda ...
- Mysql update error: Error Code: 1175. You are using safe update mode and you tried to update a table
Mysql update error: 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……
今天遇到一个mysql错误: Error Code: . You are using safe update mode and you tried to update a table withou ...
- MySQL 误删数据、误更新数据(update,delete忘加where条件)
MySQL 误操作后数据恢复(update,delete忘加where条件) 关键词:mysql误删数据,mysql误更新数据 转自:https://www.cnblogs.com/gomysql/p ...
- 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 ...
随机推荐
- memcached-session-manager的一些理解
1.节点分配 粘性规划: Tomcat-1(t1)将session优先备份在运行在令一台机器上的memcached-2(m2)上面,仅当m2失效的时候,t1才会将sessin存储在m1上面(m1是t1 ...
- FPGA开发(3)
转载 榨干FPGA片上存储资源 记得Long long time ago,特权同学写过一篇简短的博文<M4K使用率>,文章中提到了Cyclone器件的内嵌存储块M4K的配置问题.文中提到了 ...
- 常用封装--Date篇--获取格式化的日期对象
虽然日期对象可以使用new Date()来获取,但是对于其格式却必须进行相应的转换,才能成为开发者想要的格式. 这里提供了一个封装的方法,通过结合正则表达式的使用,达到了可以对时间对象进行处理,生成多 ...
- IOS优秀博客
链接地址:http://www.cnblogs.com/keithmoring/p/4155264.html 剑心的博客信息量很大,适合查阅和入门,学习完,你差不多就可以出山了,还有作为复习IOS的一 ...
- 微软TTS示例
#include "sphelper.h" #include "sapi.h" #pragma comment(lib, "sapi.lib" ...
- 本地搭建开发环境开发redis程序
1.因为redis是部署在linux环境下,远程要想连接到linux,首先将linux防火墙关闭: service iptables stop
- Javascript的数组操作[转]
1.shift:删除原数组第一项,并返回删除元素的值:如果数组为空则返回undefined var a = [1,2,3,4,5]; var b = a.shift(); // 结果 a:[2,3,4 ...
- Red Hat Enterprise Linux Release Dates
Red Hat Enterprise Linux Release Dates UpdatedMay 10 2016 at 10:57 PM - English The tables below lis ...
- Codeforces 707D Persistent Bookcase(时间树)
[题目链接] http://codeforces.com/problemset/problem/707/D [题目大意] 给出一个矩阵,要求满足如下操作,单个位置x|=1或者x&=0,一行的数 ...
- LDAP Authentication for openNebula3.2
LDAP Authentication 3.2 The LDAP Authentication addon permits users to have the same credentials as ...