1. 程式人生 > >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 safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode

error without 使用 using ble mod code span set

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 總結

這篇文章僅作為記錄使用。  

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