MySQL recovery guide

How to recover MySQL using Percona

Percona XtraBackup gives you a clean way to restore a MySQL or MariaDB data directory when the live server is damaged, corrupted, or missing files.

When this method applies

Use Percona recovery when you have a physical backup created with XtraBackup and you need to restore the database files, not just reload a logical dump. It is a good fit for server failures, corrupted InnoDB tablespaces, accidental file loss, or a broken datadir after an update.

Recovery steps

  • Confirm the backup was created with the same major database family and the correct XtraBackup version for that backup set.
  • Unpack or decrypt the backup if needed, then run the prepare step so InnoDB redo is applied and the files become consistent.
  • Stop MySQL or MariaDB before touching the live datadir.
  • Move the damaged datadir out of the way and create a clean destination directory if your process requires it.
  • Use `xtrabackup --copy-back` or `--move-back` to place the prepared files into the datadir.
  • Fix ownership and permissions so the database service can read the files again.
  • Start the server and verify the error log, tables, and application connections.

Incremental backups

If you have incremental backups, apply them in order to the base backup before copying anything back to the live server. Skipping the prepare sequence usually leaves the backup in an unusable state because the data files and redo logs are still out of sync.

Common mistakes

  • Restoring onto a running database service.
  • Mixing backup files from different backup runs.
  • Using the wrong XtraBackup build for the data version.
  • Forgetting to restore ownership with the mysql or mariadb service account.
  • Trying to repair a broken backup without checking the MySQL error log first.

When the backup is not enough

If there is no usable Percona backup, or the backup itself is damaged, recovery becomes a data-reconstruction job instead of a restore. In that case the next step is usually log review, file-level inspection, and in some situations a controlled `innodb_force_recovery` startup so the remaining data can be extracted.

Need recovery help?

Cyber Duct Tape can help recover MySQL or MariaDB data, validate backups, and rebuild broken Linux hosting environments for Lakewood, Colorado and remote clients.