Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bookercodes/f0580814de506a1a4376 to your computer and use it in GitHub Desktop.
Save bookercodes/f0580814de506a1a4376 to your computer and use it in GitHub Desktop.
I will put this on my blog once it is up and running.

#How to Solve Error Code: 1175 in MySQL Workbench 6.2

Problem:

You want to perform an unconditional statement like

UPDATE dbo.Customers
SET approved = 1

DELETE *
FROM dbo.Customers

-- these statements are both unconditional as there is no "where" phase.

But when you do, Workbench 6.2 complains with the following 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 Queries and reconnect.

Unconditional statements are rarely intended. In order to prevent you from accidentally deleting your tables, Workbench disallows UPDATE or DELETE statements without a WHERE phase. However, during development, it is common to want to delete your table or update all records. This is why Workbench also allows you to disable what it refers to as "Safe Updates".

Solution

  1. Go to the menu item entitled Edit and then Preferences.
  2. Go to the vertical tab entitled SQL Editor
  3. Un-check the checkbox at the bottom of the tab page entitled Safe Updates
  4. Press Ok
  5. Restart Workbench

Explaination

The solution to this problem well documented for versions of MySQL lower than 6.2 however, in version 6.2. the location of the check box changed.

When working locally,it is often useful to delete all the records in a database however, in production, this is rarely a good idea. It is certainly not something you want to do on accident and so, it is reasonable for Workbench to enable safe updates by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment