Restore MySQL/MariaDB with BURP


Dump destination directory: /var/lib/mysql-backup

The mysql-pre-backup script uses mysqldump to export all MySQL or MariaDB data in a consistent data format before every BURP run, usually once a day. The destination files are named after the database name and compressed using gzip. The global database is named mysql.

Example file list:



Backups can be re-imported with the main mysql command line client as they’re SQL scripts. The following commands should be seen as examples. An actual restore procedure depends on the situation at hand (partial restore after accidental data removal or a full restore after catastrophic hardware failure).

  1. Restore from BURP (see Restore Files from Backup for details and more options):

    $ burp -a r -d ~/restore -r ^/var/lib/mysql-backup/
  2. Create database if necessary:

    $ echo "CREATE DATABASE <dbname>;" | mysql
  3. Load backup (destructive!):

    $ gunzip < ~/restore/var/lib/mysql-backup/mysql-<dbname>.sql.gz | mysql <dbname>