Deleted all comments by accident

I just accidentally deleted all comments made on this blog.

This blog is homegrown and hand-made. It has a very simple spamfilter that catches most spam comments. The few that make it through though, I've been deleting myself using the mysql console.

I tend to write simple queries, ending in: .. AND id = 1234, but today I forgot the id =. I had a backup from October 2008, so some old comments are back now, but I'm still pretty sad.

Lesson from today: make backups! I'm pretty good with things I do for clients, but I tend to not uphold the same standards for my own projects.

Web mentions


  • Rob


    Sidekick status!!
  • Brian


    Another tip - run mysql with --i-am-a-dummy (aka --safe-updates). If you're on Linux, you can even alias it:

    alias safemysql=mysql --i-am-a-dummy
  • Ryan Thiessen

    Ryan Thiessen

    Ouch. However, we've all been there before. At least you learned this lesson on your own dataset, some admins at Danger could have used that lesson quite recently...
  • Anon


    Um... LIMIT much?
  • paul

    you fucken loser!
  • Matt


    one word... BACKUPS!
  • Les


    These things happen to the best of us, and your not alone by taking it easy with your own projects, as developers, we are all lazy.

    It's in our nature :o
  • Anonymous

    Doesn't MySQL have BEGIN TRANSACTION? Which you can then rollback?
  • Vadim


    If you use InnoDB, it's still possible to get data back.
    You can check InnoDB recovery tool.
  • Andy Walpole

    Andy Walpole

    oh dear oh dear oh dear... he he :)
  • Mohammad Lahlouh

    Mohammad Lahlouh

    Are you turn on the binary log?

    you can execute bin log from the backup time to delete statement.

    It's easy
  • Richard Heyes

    Richard Heyes

    You're not alone! I recently very nearly lost my entire blog due to a server crash. I've now got more backups than I know what to do with. A bit daft really - only need a couple... :-/
  • Joris van de Sande

    Joris van de Sande

    Too bad that you have lost all your comments :(. Thanks for the reminder! As soon as I get home today I am going to write a backup script.
  • equivoc


    Check google cache:
  • Pikaczu


    What about using mysql tools that have "safe query" detection, like this: - see the screenshot and the feature "Error: Detected UPDATE/DELETE without WHERE condition ..."
  • Evert


    Thanks for all the replies :)

    I do have a binary log! Good point !

    Now I need to find out how to rewind it, without affecting the new data..