You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column

Error Code: 1175
You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column

Every found that kind of error when trying to update rows in mysql? It’s because you tried to update a table without a WHERE that uses a KEY column (err …).

Anyway, The quick fix is to add SET SQL_SAFE_UPDATES=0; before your update query. Here’s the example:

SET SQL_SAFE_UPDATES=0;
DELETE FROM people WHERE person_status = 'deceased';
About these ads
Tagged , , ,

19 thoughts on “You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column

  1. Neeraj says:

    Thanks. It’s really help me I am using MYSQL Work Bench and It’s work. Thanks again

  2. www.buy-xbox-games.net says:

    close the safe update mode.
    Edit -> Preferences -> SQL Editor -> SQL Editor
    remove Forbid UPDATE and DELETE statements without a WHERE clause (safe updates)

  3. Jane says:

    Thank you – just what I needed!

  4. totta says:

    thx alot ti helps me alot thanks again ^_^

  5. [...] You are using safe update mode and you tried to update a table without a WHERE that uses a KEY colum…. Like this:НравитсяБудьте первым, кому понравился этот . [...]

  6. Suren says:

    Thanks u.. This one saved me ;)

  7. Well, its not best solution to deactivate it.

    Much safer (and its not so global solution) is just to add LIMIT constraint.

    Turning it off globally may occurs in screwing your database one day :)

  8. lalit says:

    nice info

  9. saiprasad says:

    Thank you – just what I needed!

  10. Jason says:

    For MySQl 5.6, Workbench 5.2.47, I found the option in Edit->Preferences->SQL Queries and untick “Safe Updates”.

    This blog post help me cos the error on the console just said “toggle the option in Preferences -> SQl Queries” which I couldn’t find. It should read “toggle the option in Edit -> Preferences -> SQl Queries”!!

    Thanks for the help!

  11. Israel says:

    thanks, I will need this instruction.

  12. Ram Mohan Reddy says:

    Thanks a lot it worked for me.

  13. Jerome says:

    Basic, simple but how useful tip! Thank you

  14. Young says:

    I have a question with this… how to return it back to normal?

    should I? SET SQL_SAFE_UPDATES=1;

    • James K. says:

      Yes. When using this I execute something like this.

      SET SQL_SAFE_UPDATES=0;
      DELETE FROM peopleToSpam WHERE deceased=’true’;
      SET SQL_SAFE_UPDATES=1;

  15. Dado says:

    thx! you save me a lot of time!

  16. far says:

    thanks, this is really helpful

  17. Muchas gracias mi amigo me sirvió mucho.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: