Creating another MYSQL instance and restoring DB (R1soft)

Big on Hosting. Unlimited Space & Unlimited Bandwidth

1. Restore the raw DB files from the recovery point:
ib_logfile0 ib_logfile1 ibdata1 /var/lib/mysql/mysql /var/lib/mysql/_dbname

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.

2. Start a 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.

3. 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

4. Cleanup
Stop the temp instance by killing the process and delete the restored files.


Both comments and pings are currently closed.

Comments are closed.