Starting a temporary MySQL instance for table/DB recovery

In this example we assume a restored backup of mysql’s datadir exists at /mnt/restore/mysql.

mysqld --port=3307 --socket=/mnt/restore/mysql/tmp.sock --datadir=/mnt/restore/mysql --pid-file=/mnt/restore/mysql/ --user=mysql

If the backups are ‘dirty’ and innoDB corruption won’t let it start, you can try –innodb-force-recovery=N if needed (start with N = 1 and go up to 4 as neccesary).

If the instance was part of a cluster, you may need to delete galera.cache and dat files.

Once the backup instance is started and running, you can cherry-pick DB’s or tables as needed by using –port=3307 in mysql or mysqldump commands.

If you’re only interested in a single DB, you can save time by skipping unneeded DB’s during the filesystem restore. The following would be a minimal datadir structure for accessing only the “magento” DB:


Mysqld will complain about the missing/unwanted DB data folders, but it should still start. It may also start without the ib_logfile0 and ib_logfile1 but could cause issues if the backup is dirty.

No Comments.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Anti-Spam Quiz: