When you delete a record in the mysql database today, the following error message is displayed:
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-> Query Editor and reconnect.
After searching for information, I found that mysql has a variable named SQL _SAFE_UPDATES. For the security of database update operations, the default value is 1, so the update fails.
The following describes the values of SQL _SAFE_UPDATES when the variables are 0 and 1:
SQL _SAFE_UPDATES has two values: 0 and 1,
When SQL _SAFE_UPDATES = 1, the update and delete operation statements without the where and limit conditions cannot be executed, even the update and delete operations with the where and limit conditions but without the key column cannot be executed.
When SQL _SAFE_UPDATES = 0, the update and delete operations will be executed smoothly. Obviously, the default value of this variable is 1.
Therefore, when a 1175 error occurs, you can set the SQL _SAFE_UPDATES value to 0 and then perform the update. For example:
SQL _SAFE_UPDATES = 0;
Delete from testTable where name = 'zhangsan ';