HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

I deleted a folder from /var/lib/mysql and now all of my databases seem to be unaccessible

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
varseemdatabasesunaccessiblealllibnowmysqldeletedfolder

Problem

I was receiving this error when trying to drop a database:

ERROR 1010 (HY000): Error dropping database (can't rmdir './redpopdigital@002ecom', errno: 39 "Directory not empty")


So I went into /var/lib/mysql and just did an rm -rf. I did not know that this would screw with literally every other database.

Now it seems all of my databases are inaccessible.

I tried this as a troubleshooting step:

ubuntu@blainelafreniere:~$ mysqlcheck --repair blainelafreniere -u root -p
Enter password: 
blainelafreniere.wp_commentmeta
Error    : Table 'blainelafreniere.wp_commentmeta' doesn't exist in engine
status   : Operation failed
blainelafreniere.wp_comments
Error    : Table 'blainelafreniere.wp_comments' doesn't exist in engine
status   : Operation failed
blainelafreniere.wp_links
Error    : Table 'blainelafreniere.wp_links' doesn't exist in engine
status   : Operation failed


what's weird is, all of the data appears to be chilling in /var/lib/mysql... but I can't access it for some reason?

Is there any hope of recovering the data from /var/lib/mysql or am I completely screwed?

Thanks.

Solution

I went into /var/lib/mysql and just did an rm -rf. I did not know that this would screw with literally every other database.

Oh dear.

Your machine was trying to prevent you from deleting something - but you forced it to anyway?

The thing it was trying to protect was inside your MySQL installation - and that didn't give you pause either?

Now it seems all of my databases are inaccessible.

No. All of your database are gone. Toast. Trashed. "Shuffled off this Mortal Coil...", etc.

Things to do:

  • Restore your databases from Backup (the ones you've been taking expressly for this kind of "Disaster Recovery" exercise).



  • Go and read [a little] about how MySQL uses its Data Directory.



  • In future, try to avoid mucking about with any database at the file system level, if at all possible.



I appreciate you had what appeared to be a file system problem but investigating and [correctly] resolving that issue would have saved you an awful lot of grief.

Context

StackExchange Database Administrators Q#280112, answer score: 4

Revisions (0)

No revisions yet.