MySQL - Point-in-Time Recovery (PITR) in MySQL
1. What is Point-in-Time Recovery?
-
Definition: Point-in-Time Recovery (PITR) lets you restore your MySQL database to an exact moment in the past, not just the time of your last full backup.
-
Useful when:
-
Someone accidentally deletes or updates data.
-
A bug corrupts your records.
-
You want to undo changes that happened after a specific timestamp.
-
2. How PITR Works
PITR in MySQL is based on two things:
-
Full Backup (e.g., with
mysqldump
ormysqlpump
or physical backup tools likePercona XtraBackup
). -
Binary Logs (binlogs) — these logs record every change (INSERT, UPDATE, DELETE) after the backup.