Restore InnoDB MySql from one AWS EC2 to another EC2
I am sharing this experience and recovery option because i faced this issue while one IT person destroy EC2 instance but luckily he forgot to delete volume used for EC2. I am able to restore required MySql Databases.
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
/var/lib/mysql/[DBNAME]. As far as I know, this folder must be the same name as the old database.
- Copy the
ibdata1file from your old server to
- *THIS IS IMPORTANT. Make sure the permissions of the files are correct.I simply did
sudo chmod -R 777 /var/lib/mysql.
Note : This is not recommended if your server is a production server.
- Start the mysql service (
sudo service mysql start)