mysql 用非主键where语句报错Error Code: 1175.You are using safe update mode and you tried …

1)这是因为MySql运行在safe-updates模式下,该模式会导致非主键条件下无法执行update或者delete命令,执行命令SET SQL_SAFE_UPDATES = 0;修改数据库模式

执行完更新之后再将SET SQL_SAFE_UPDATES 恢复为 1;

2)或者还可以在条件后面加limit语句加以限制。

时间: 2024-08-14 02:05:29

mysql 用非主键where语句报错Error Code: 1175.You are using safe update mode and you tried …的相关文章

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

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

SQL更新语句,Error Code: 1175. You are using safe update(在进行视图更新的时候遇到)

转发于:http://blog.csdn.net/qq_26684469/article/details/51105188?locationNum=5&fps=1 原来的SET SQL_SAFE_UPDATES = 1; 如果条件定语从句where后面跟的不是主键,则会报上面的错,将上面的安全级别设低一点即可,如下: SET SQL_SAFE_UPDATES = 0; 再执行更新语句,如 SET SQL_SAFE_UPDATES = 0; update project.demand set ti

MySQL Workbench update语句错误Error Code: 1175.

rom:http://www.tuicool.com/articles/NJ3QRz MySQL update error: 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 Queri

mysql delete数据时报Error Code 1175

我们在学校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 Editor and reconnect. 0.000 sec

MySQL中出现Multiple primary key defined报错提示之解决办法

创建主键可以有两种方式: create table 表名(字段名 类型,字段名 类型,--primary key(name)); 或者是 create table 表名(字段名 类型 primary key,字段名 类型,--); 但是要注意的是,想要创建复合主键,就不可以用第二种方式.下面列举一个小例子:这里报错Multiple primary key defined,表示定义了多个主键,正确的写法是如下:如果项设置复合主键,复合主键的特点是同时创建.同时删除,所以需要把主键删除,但是这里设置

mysql非主键自增长

mysql并非只有主键才能自增长,而是设为键的列就可以设置自增长. 如下: 1 2 3 4 CREATE TABLE t1 (     id INT,     col1 INT auto_increment NOT NULL ); 结果如下: 如果把col1列设为键,就可以创建自增. 1 2 3 4 5 CREATE TABLE t1 (     id INT,     col1 INT auto_increment NOT NULL,     key(col1) ); 结果如下: 如果我们把i

外键关联非主键id时-hbm.xml配置,及其分页查询DaoImpl

表关联时,外键关联非主键id时-hbm.xml配置: (由于hibernate默认为关联主键查询,故需要配置相关hql语句的属性) <many-to-one name="areas" class="com.hnqy.entity.Areas" fetch="select" property-ref="areaid" foreign-key="areaid"> <column name=&q

mysql主从:主键冲突问题

1.检查从库 show slave status \G; Slave_IO_Running: YesSlave_SQL_Running: No 2.出现类似如下的报错: Last_SQL_Error: Error 'Duplicate entry '1001-164761-0' for key 'PRIMARY'' on query. Default database: 'bug'. Query: 'insert into misdata (uid,mid,pid,state,mtime) va