't Bijstere spoor

't Bijstere spoor

A blog about Web development

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.


Comments

Rob
Rob said on Tuesday, 13 October 2009 at 1:24 am CEST

Sidekick status!!

Brian
Brian said on Tuesday, 13 October 2009 at 1:33 am CEST

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 said on Tuesday, 13 October 2009 at 2:18 am CEST

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
Anon said on Tuesday, 13 October 2009 at 2:21 am CEST

Um... LIMIT much?

paul
paul said on Tuesday, 13 October 2009 at 2:23 am CEST

you fucken loser!

Matt
Matt said on Tuesday, 13 October 2009 at 2:40 am CEST

one word... BACKUPS!

Les
Les said on Tuesday, 13 October 2009 at 3:15 am CEST

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
Anonymous said on Tuesday, 13 October 2009 at 4:24 am CEST

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

Vadim
Vadim said on Tuesday, 13 October 2009 at 6:03 am CEST

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

Andy Walpole
Andy Walpole said on Tuesday, 13 October 2009 at 8:27 am CEST

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

Mohammad Lahlouh
Mohammad Lahlouh said on Tuesday, 13 October 2009 at 8:39 am CEST

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 said on Tuesday, 13 October 2009 at 10:38 am CEST

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 said on Tuesday, 13 October 2009 at 10:45 am CEST

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
equivoc said on Tuesday, 13 October 2009 at 11:06 am CEST

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

Pikaczu
Pikaczu said on Tuesday, 13 October 2009 at 1:11 pm CEST

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

Evert
Evert said on Tuesday, 13 October 2009 at 2:27 pm CEST

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







Solve this simple math problem to prevent bots from spamming this blog:
9 + 10 =