MySQL Error Code: 1175. 错误 作者: jlb 2019年12月10日  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 一次对于数据库更新错误:在更新条件中没有添加主键条件 错误原因:这是因为MySql运行在safe-updates模式下,该模式会导致非主键条件下无法执行update或者delete命令。 ```mysql update user set active=0 where active=1; ``` 错误信息 ``` 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. ``` 解决方法(更改只在当前生效,退出mysql,再次登录后恢复为默认。) 1. `show variables like 'sql_safe_updates';`查看开关状态。  2. 更改SQL_SAFE_UPDATES:`set sql_safe_updates=0;` 或者 `set sql_safe_updates=off;` 3. 执行update命令 4. 因为本次修改SQL_SAFE_UPDATES只在当前登录有效所以可以退出重新登录回复或者执行`set sql_safe_updates=on; `或 `sql_safe_updates=1;`将状态恢复