Error Code: 1175 - You are using safe update mode


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?


Asked by:- neena
2
: 4658 At:- 6/2/2022 11:38:00 AM
SQL MySQL Workbench error 1175







2 Answers
profileImage Answered by:- vikas_jk

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.

Disable Safe Mode using Query in MySQL

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;

Disable Safe Mode using GUI of MySQL Workbench

To disable it using MySQL Workbench User Interface

  • In MySQL Workbench, Go to Edit -> Preferences
  • Click "SQL Editor" tab and uncheck "Safe Updates" check box
    mysql-workbench-1175-error-safe-update
  • Logout or disconnect from localhost/server database and then re-connect
  • Now execute your SQL query, it should run

Thanks, hope it helps.

1
At:- 6/2/2022 11:50:27 AM
Thanks for excellent and perfect answer, I disabled it using MySQL Workbench GUI permanently and query was executed as needed, thanks 0
By : neena - at :- 6/2/2022 11:52:35 AM


profileImage Answered by:- jon

"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

0
At:- 12/12/2022 3:23:54 PM






Login/Register to answer
Or
Register directly by posting answer/details

Full Name *

Email *




By posting your answer you agree on privacy policy & terms of use