Creating another MYSQL instance and restoring DB (R1soft)

hostgliders

New member
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.
 
Yeah... What about it?

This is the hosting discussion section - I'm not sure if there's a 'how-to' section but if so - it seems like that would be a better place for this :).
 
Just to point out, if you are using R1Soft, this can be achieved with a few mouse clicks, you don't actually need to know how to do this, as the agent will do it for you!

Using a plugin (we do) your customer can also restore their own files and databases.
 
Back
Top