Recovering from mysqldump and mysqlpump
The logical backup tools mysqldump
and mysqlpump
write data to a single file.
How to do it...
Log in to the server where the backups are available:
shell> cat /backups/full_backup.sql | mysql -u <user> -p or shell> mysql -u <user> -p < /backups/full_backup.sql
To restore on the remote server, you can mention the -h <hostname>
option:
shell> cat /backups/full_backup.sql | mysql -u <user> -p -h <remote_hostname>
When you are restoring a backup, the backup statements will be logged to the binary log, which can slow down the restoration process. If you do not want the restoration process to write to the binary log, you can disable it at the session level using the SET SQL_LOG_BIN=0;
option:
shell> (echo "SET SQL_LOG_BIN=0;";cat /backups/full_backup.sql) | mysql -u <user> -p -h <remote_hostname>
Or using:
mysql> SET SQL_LOG_BIN=0; SOURCE full_backup.sql
There's more...
- Since backup restoration takes a very...