Monday, April 09, 2012

Database Dropped

If you're like me, you will someday experience that terrifying, dreadful feeling upon reading these words on your phpMyAdmin screen...


Database `whatever` has been dropped.

...having apparently ignored the warning that just appeared saying:

You are about to DESTROY a complete database! Do you really want to: DROP DATABASE `whatever`

...and blithely pressing Enter.

When this happens, and it will, there are a few things you should do:

  • refrain from panicking
  • take a few deep breaths
  • go back and time and BACK UP YOUR DATABASE
Fortunately, in my case, only the first two steps were necessary, because I use Time Machine on my MacBook and hadn't made any updates to the database since the most recent backup.

I should say that I'm running MAMP, and while I don't know if all MySQL databases are stored this way, I can't imagine there would be much a difference in how you would restore your own database from backup.

All I had to do was open the /Applications/MAMP/db/mysql folder in Time Machine, select the directory that used to be my database and click Restore. That's it.

And after popping into phpMyAdmin to make sure that my data was actually safe, there were just a couple more actions required:
  • thanking my lucky stars
  • vowing never ever ever to blithely click another alert without reading it.

No comments: