#Database Backup Recovery
#Prerequisites
- The database is MariaDB
mariadb-backup
is installed- You have a compressed backup file containing the state of the database to which you want to recover
#Take a Manual Backup
Before continuing with data recovery, I highly recommend creating a manual backup, in case you need to revert back to the state before recovery started.
#Recover the Data
Create a directory for storing the recovered files temporarily. It can be named anything you like. Here it is named recovered
.
Unzip the compressed database backup in the directory.
Prepare the recovery files. This is necessary because files created at backup time are not point-in-time consistent and MariaDB will reject the recovery if not properly prepared.
Stop MariaDB.
Remove all existing data files.
Restore the backup files.
Change ownership of the newly recovered files so that the mysql
user can access them properly.
Start MariaDB.
The database is now restored back to the state it was in when the backup was taken.
Remove the recovery files as they are no longer needed.