SolarWinds Backup Help

MySQL recovery

Backup Manager lets you restore the MySQL instances it has backed up. Note that the whole instance is restored (it is not possible to select a particular database, file or table from it).

You can recover MySQL (using the Backup Manager or command line) to either of the following:

  • To the current location (in-place restore). An in-place restore can only be performed only if the following is true:
    • MySQL configuration is the same as during the backup
    • All MySQL data is inside the datadir folder on Linux, MacOS and Windows.

      On Windows the innodb_data_home_dir and innodb_log_group_home_dir folders are also supported for in-place restores.

  • To a new location. In this case you will need to move the files to an appropriate folder where MySQL can recognize them. Please do not forget to stop the MySQL service before doing it.

How in-place restores work

How in-place restore works after the Restore is started:

  1. Make a request to MySQL server to get the path to the restore data
  2. Get the MySQL server user
  3. Stop the MySQL service
  4. Restore files to the requested location
  5. Change the files owner and group to the MySQL server user
  6. Start MySQL service
  7. Right now only the initd service manager is supported to stop and start MySQL service.

Starting the MySQL service on Security-Enhanced Linux after recovery

SELinux may prevent the MySQL Server Daemon from accessing the database files after recovery. It results in error #13: Can't open the mysql.plugin table. Please run mysql_upgrade to create it.

To resolve the error, you can reset the security context of the database files, for example using the restorecon program.

restorecon -Rv /var/lib/mysql

It may also be necessary to repeat the command for other files and directories which have been restored.

Use the man restorecon command to get additional information about restorecon.

Restore through the command line

  1. Start your terminal emulator and move to the Backup Manager installation directory.

    cd /opt/MXB/bin

  2. Initiate the recovery of your MySQL server.

    ./ClientTool control.restore.start -datasource MySql -selection mysqldb

    Here are some options:

    • You can restore to the current directory (in-place restore) under certain circumstances. To perform a restore to an intermediate directory, specify the -restore-to parameter, for example -restore-to /tmp.
    • You can specify the backup session that you want to restore (by default the most recent session is selected). This is done using the -time parameter – for example -time "2016-09-02 14:44:39".

    You can check the current status of the restore session using the control.session.list command.

  3. (if applicable)

    If you recovered MySQL to an intermediate directory, you will need to copy the recovered files to the appropriate data directory for the recovered instance.

    For example, on Linux

    /var/lib/mysql

    For example, on Windows

    C:\ProgramData\MySQL\MySQL Server 5.5\data

  4. (if applicable)

    On Linux, original file locations and permissions cannot be determined, because Percona XtraBackup files are used and these do not contain the original file locations and permissions.

    For example:

    chown -R mysql:mysql /var/lib/mysql

  5. Restart the MySQL service to apply the changes.

Important

To get details on a particular command (output structure, required arguments and optional arguments), enter the following string to your terminal emulator:

./ClientTool help -c <command>