Pragmatism in code

Waxing lyrical about life the universe and everything software related since lunchtime 2006.

Recovering InnoDB tables from database files.

After a hiatus of several months the site is back up. The site was unfortunately victim to some script kiddies and fell under the scrutiny of my hosting provider. After a failed attempt to rewind to a previous backup, which turned out to be corrupt, I decided that rather than spend a bunch of time that I did not have spare trying to fix it, I would simply turn the server off and get back to it later. Of course I did not consider that 'later' may stretch to be several months but that's just the way it panned out to be.

So I finally got some free time and decided to take a look at getting the server back up and running. The original issue with the original server was that due to a kernal issue with the server itself, the backup service provided by my host generated corrupted backups, so reinstalling from a backup invariably led to a bricked server. I spent some time working with the host to get the server repaired and whilst I did get a server that I could SSL into I unfortunately did not get any further as the SQL service would not run due to toasted database files.

So with renewed enthusiasm to get the site back up the first thing I did was to create a new server instance. Might as well start afresh, especially with the kernel issue - a problem I did not want to walk back into. I then grabbed all of the database files from the original server which were located at /var/lib/mysql/"DB-Name"

MySql is great in that you can simply physically copy the files from one database to another and the database will become available, however there are some caveats to this. 

Continue reading
132 Hits