Home MySQL安全模式
Post
Cancel

MySQL安全模式

MySQL安全模式要求不能对非主键的条件查询做update和delete操作

报错信息

1
2
3
4
5
update activity set type = 1 where title = 'aa'
 
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

解决方法

查看安全模式开关状态

1
show variables like 'SQL_SAFE_UPDATES';

关闭安全模式

1
SET SQL_SAFE_UPDATES = 0;

参考:MySQL安全模式

This post is licensed under CC BY 4.0 by the author.