1. Home
  2. Knowledge Base
  3. Server Management
  4. Manually restore MySQL through R1Soft

R1soft alternate MySQL restore method

  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.

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

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

  1. Cleanup

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

Was this article helpful?

Related Articles

Leave a Reply

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