MySQL安全模式

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

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

解决如下:
查看安全模式开关状态

show variables like 'SQL_SAFE_UPDATES';

关闭安全模式

SET SQL_SAFE_UPDATES = 0;

在workbench中也有自己的安全模式设置
edit>preference


图片.png

去掉选中以关闭安全模式

你可能感兴趣的:(MySQL安全模式)