In this post, we will learn how to solve a SQL error that is known as Error Code: 1175 or safe update mode MySQL error 1175.

or maybe you are known to this error because it comes in your MySQL workbench kinda like this.

error-code-1175-you-are-using-safe-update-mode

So if you see the error in row number 5 in the above-mentioned picture you will notice in the message column that’s saying.

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.

And You can also choose the best way to handle it. The most common way to handle it Through a SQL Query.

 	
SET SQL_SAFE_UPDATES = 0;
update yourTableName SET columnNames = "";
SET SQL_SAFE_UPDATES = 1;

So Basically, with the above query, we are disabling the safe update option then we do our update then we set our safe update option enabled.

If you think you are good enough in SQL and you know what you are doing then you can keep it disabled. But best practice is to keep it enabled.

As you see in the above error message. Yes, it’s quite right that you can toggle the option in Preferences -> SQL Editor and you can solve it.

the steps are mentioned below

  1. Go to Edit –> Preferences

2. Click “SQL Editor” tab and uncheck “Safe Updates” check box

3. Query –> Reconnect to Server

4. Now execute your SQL query.

safe-update-mode-sql-Gui-1
safe-update-mode-mysql-gui-2

I hope it helped you. If it’s not please let me know what exactly you are facing I would love to try my best to solve your problem.

Tagged:

Laisser un commentaire