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.


15 Responses to Deleted all comments by accident

  1. 1008 Rob 2009-10-12 11:24 pm

    Sidekick status!!

  2. 1009 Brian 2009-10-12 11:33 pm

    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

  3. 1007 Ryan Thiessen 2009-10-13 12:18 am

    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...

  4. 1005 Anon 2009-10-13 12:21 am

    Um... LIMIT much?

  5. 1003 Matt 2009-10-13 12:40 am

    one word... BACKUPS!

  6. 1004 Les 2009-10-13 1:15 am

    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

  7. 1001 Anonymous 2009-10-13 2:24 am

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

  8. 1002 Vadim 2009-10-13 4:03 am

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

  9. 1000 Andy Walpole 2009-10-13 6:27 am

    oh dear oh dear oh dear... he he :)

  10. 999 Mohammad Lahlouh 2009-10-13 6:39 am

    Are you turn on the binary log?

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

    It's easy

  11. 998 Richard Heyes 2009-10-13 8:38 am

    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... :-/

  12. 997 Joris van de Sande 2009-10-13 8:45 am

    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.

  13. 996 equivoc 2009-10-13 9:06 am

    Check google cache: http://209.85.129.132/search?q=cache:LT42H3QFnacJ:www.rooftopsolutions.nl/article/253+http://www.rooftopsolutions.nl/article/253&cd=1&hl=de&ct=clnk&gl=de&client=firefox-a

  14. 995 Pikaczu 2009-10-13 11:11 am

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

  15. 994 Evert 2009-10-13 12:27 pm

    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..



About

My name is Evert, and I've been writing semi-regularly on this blog since 2006.

I'm currently available for contract work.

more info.

Subscribe

Dropbox

Dropbox is a simple cross-platform online backup and sync application. The first 2GB of space is free, and both you and me get an extra 250MB extra space if you sign up through this link.