Restoring MySQL database from Amazon Snapshot

If you have been backing up the Amazon Volumes you can restore them quite easily and restore your data. Here you go

  1. Launch a new instance
  2. Create a volume from the desired snapshot
  3. Attach the volume the instance at /dev/sdf
  4. Login to the new instance via shell
  5. Create a new directory sudo mkdir /backup
  6. Mount the volume on this directory sudo mount -t ext4 /dev/sdf /backup
  7. To restore mysql install mysql with sudo yum install mysql mysql-server
  8. Edit /etc/my.cnf and change the data director to datadir=/backup/var/lib/mysql
  9. Start mysql with sudo service mysqld start

Now you can login with the appropriate user and export the required database / tables.

Post new comment