How to test that a MySQL or MariaDB backup restores
A MySQL or MariaDB backup is proven only by restoring it and checking the data. This guide shows how to test a dump by hand, what to check, and how Restorly automates it.
A dump file that exists, has a sensible size and ends with -- Dump completed can still fail to restore: a table it depends on is missing, a view or trigger references an object that is gone, the dump was made without --routines, or it was cut short by a full disk. Only a restore finds those.
Test a dump by hand
Restore into a throwaway server of the same version as the production server, with no network, so nothing can reach it and it can reach nothing:
docker run -d --name restore-test --network none \
-e MARIADB_ROOT_PASSWORD=test mariadb:11.8
docker exec restore-test mariadb-admin --password=test --wait=30 ping
For MySQL use the mysql image of your version, MYSQL_ROOT_PASSWORD, and the mysql and mysqlcheck commands instead of mariadb and mariadb-check.
Load the dump. A dump made with --databases or --all-databases creates its databases; otherwise create the database first and load into it:
docker exec restore-test mariadb --password=test -e "CREATE DATABASE shop"
gunzip -c shop-2026-11-16.sql.gz | docker exec -i restore-test mariadb --password=test shop
Any error stops the test: the backup does not restore as it is.
What to check after the restore
- Table consistency:
docker exec restore-test mariadb-check --password=test --all-databases --checkreports every table that is damaged. - Row counts: compare the number of rows of each table with the last test, or with production. A table that suddenly has far fewer rows, or none, is a problem even when the restore succeeded.
- The schema: tables, views, routines, triggers and events. A dump made without
--routines --events --triggersrestores without them. - Recent data: the newest row of a busy table shows how old the backup really is, for example
SELECT MAX(created_at) FROM shop.orders. - Your own expectations: a query only your application knows, such as "every order has a customer".
Write down how long the restore took: that is your real recovery time, not the time the backup took. Then remove the container: docker rm -f restore-test.
Physical backups
A mariadb-backup or Percona XtraBackup backup is tested by preparing it (mariadb-backup --prepare --target-dir=…, or xtrabackup --prepare) and starting a server of the same version on the prepared directory. Then run the same checks as for a dump.
How Restorly does this
Restorly runs exactly this on a schedule, or whenever a new backup arrives, for every database you point it at: it finds the newest backup where it already is (a local disk, a NAS, an SFTP host, S3 storage), restores it in a container of the matching version with no network, runs CHECK TABLE, compares row counts and the schema with the last run, runs your own SQL checks, records the restore time and signs a report. It reads dumps from mysqldump, mariadb-dump and mydumper, mariadb-backup backups and Percona XtraBackup backups of MySQL 8.0 and 8.4 (Supported databases and requirements, Backups made by other tools). Start with Getting started or the free trial.