R1soft alternate MySQL restore method
- Restore the raw DB files from the recovery point:
The log files, ibdata and mysql tables must always be restored in addition to the actual user database(s).
Important: Restore to an ALTERNATE location (do NOT overwrite existing location). Use e.g. /var/lib/mysql_tmp (ensure there is enough space). Folder needs to have ownership by mysql:mysql.
- Start an temporary MySQL instance
Replace the path with where the data was restored.
mysqld_safe –socket=/var/lib/mysql_tmp/mysql.sock –port=3307 –datadir=/var/lib/mysql_tmp
You now have a separate MySQL server running with the data from the restored backup. It is now posssible to connect to the instance using port 3307 or the socket path.
- Generate DB dump
To create a database dump from the temp instance, use this command (replace path to socket with actual path):
mysqldump –socket=/var/lib/mysql_tmp/mysql.sock dbname > dbname.sql
Stop the temp instance by killing the process and delete the restored files.