Let us know what you’re looking for. We strive to respond in 48 hours, but, every now and then, life gets in the way, so be patient if there’s a delay.
One of our LAMP test servers recently crashed and luckily we were able to salvage the hard disk drive from that server. Restoring the PHP web files from that box was easy, as you can imagine. We struggled to restore the databases though because we didn’t have export files like we were used to. Keep in mind that your database server version should be the same. If you’re on Ubuntu 12.04 and have kept up to date with both systems, the version numbers should match up.
Here are the steps for restoring an InnoDB MySQL Database on Ubuntu 12.04:
- Shut down the mysql service (sudo service mysql stop)
- Copy the database folder that contains the .frm files to /var/lib/mysql/[DBNAME]. As far as I know, this folder must be the same name as the old database.
- Copy the ibdata1 file from your old server to /var/lib/mysql/ibdata1
- ***THIS IS IMPORTANT. I was hung up for a while on this step. Make sure the permissions of the files are correct. Since my server was a throwaway virtual machine for restoring this database, I simply did sudo chmod -R 777 /var/lib/mysql. This is not recommended if your server is a production server.
- Start the mysql service (sudo service mysql start)
That’s it. Your database should be restored. I was really hung up on step #4 until I looked in the log file. If your service does not start for any reason, check out the log file at /var/log/mysql/error.log.
Hope this helps someone!