When I am trying to execute this query in MySQL Workbench 'DELETE FROM Job;
', I am getting below error
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.
So, how can I resolve this error, why I cannot Execute the simple delete query?
Above MySQL Workbench error also, shows solution, you need to disable Safe Mode in MySQL Workbench, you can use either of the following 2 methods.
You can simply disable it using below query
SET SQL_SAFE_UPDATES = 0;
OR
You can run this query which can be better way to do it
SET SQL_SAFE_UPDATES = 0;
#SQL Query Here
#Again Enable Safe Update
SET SQL_SAFE_UPDATES = 1;
To disable it using MySQL Workbench User Interface
Thanks, hope it helps.
"Error Code: 1175 - You are using safe update mode" appears when you are trying to run SQL Query update or delete rows without mentioning Primary Key in Where clause of query.
So if you want to run query without disabling safe
DELETE FROM Job where PrimaryKey_Column > 0
Example SQL Query, when Primary Key of table = "Id":
DELETE FROM Job where Id > 0
Thanks
Subscribe to our weekly Newsletter & Keep getting latest article/questions in your inbox weekly