It’s 1 am in the morning. I’m updating some blog posts and working on some WordPress plugins when I realized that one of the plugins doesn’t work perfectly.
So I launched PHPMyAdmin, the tool to manage MySQL tables and databases.
Looking through the list of tables in the database, one of the tables seemed to have corrupted and malfunctioned. This must be the reason why the plugin is not working.
So I thought, maybe I’ll just delete the table and reactivate the plugin. This trick should give me a new table altogether.
I proceeded to delete the table without thinking twice. Anyway, it’s 1 in the morning, why bother thinking and double-checking. So I checked the table which I wanted to delete, then clicked on the DROP button. When the dialog box pops up, without reading I just clicked on the OK button.
BAM! WHAM! DAM!
Looking through my list of databases on the left sidebar, I realized that my entire database is GONE. I have just done the unthinkable. I just dropped the entire database instead of deleting just one table which was what I had in mind. The best part, I haven’t done any backups to the database. Ouch!
Immediately, I kinda woke up. It’s like I was being controlled by something else and didn’t know what I was doing. No use crying over spilled milk now. My few days of work just went down the drain and thoughts of having to redo and repeat the entire process all over again made me feel sick and bored.
Then I thought, maybe there is a way to undo the drop database command in phpmyadmin. There must be a way out for DODOs like me.
Searching through Google, I actually found NOTHING! Yea… you read me right. No solution to this mistake.
But if any of you readers out there do know of a way to undo the drop database command, please let us know. Even if there are any third-party tools capable of undoing and recovering the database, it would be really helpful.
Googling further, someone actually recommended that we try to contact our web host about this. If they are really good and reliable, they would have done daily backups and be able to restore it for us without any cost.
So I headed over to my web hosting site Namecheap where they have a 24 hours technical support.
Chatting online with Namecheap’s technical support staff, I mentioned to him about my dropped database. He asked for a few verification questions. Once I answered him and told him which database was dropped, within 2 minutes my database was restored up to yesterday night’s version.
Phew! What a relief. Nothing was lost, except for a couple of updates, I did a few hours ago. I learned a few lessons:
- Always backup whenever possible
- Never mess with files and databases in the middle of the night
- It’s important to host my files and databases with a reliable web host.
Good job Namecheap! To anyone encountering the same problem and your database is not backed up in any way, the only thing I can say is… I FEEL your PAIN.
Interesting article. Backups are more important today then they have ever been in my opinion, if you loose your data and you cant recover it then your business is dead. Thanks again.
En fait il y a un moyen si les tables sont en innodb.
il faut pour cela remonter un backup de la base pas trop ancien, et ensuite de refaire jouer toutes les transactions stockées dans le fichier de log binnaire qu’on aura converti en sql, depuis la date du dernier backup.
Ita has just happened to me 🙁 I googled and found your post.. looks like I got selfpwned..
i did the exact same thing, emptied a database thinking i already had a backup when i didnt, luckily i asked my host if they had a backup, it was a few weeks old, but the original data was months old, so you can imagine how relieved i was…
good for you dude…