How would you design backups and disaster recovery for a production MySQL database?
AdvancedProductionMySQL
Answer
Short answer
Combine automated full backups (snapshots or physical/logical dumps), continuous binary logs for point-in-time recovery, off-site and cross-region copies, encryption, and — most importantly — regular restore tests measured against agreed RPO and RTO.
Building blocks
| Layer | Example |
|---|---|
| HA (not a backup!) | Multi-AZ / semi-sync replica with automatic failover |
| Full backups | RDS automated snapshots daily; or Percona XtraBackup / mysqldump --single-transaction |
| Point-in-time | Binlogs retained (RDS PITR up to 35 days) |
| Off-site | Copy snapshots to another region/account; S3 with versioning + Object Lock |
| Protection | KMS encryption; separate backup account so a compromised prod account can't delete backups |
| Verification | Automated weekly restore to a test instance + row-count/checksum checks |
Targets
- RPO (max data loss): binlogs/PITR give minutes.
- RTO (max downtime): Multi-AZ failover ~1–2 min; full restore of a 1 TB database may take hours — know that number by testing it.
Runbook essentials
How to restore to a point in time, how to repoint the app (DNS/endpoint), who decides, and how to verify data afterwards.
What to say in the interview
"HA from Multi-AZ, recoverability from daily snapshots plus binlogs for PITR, copies in another region and account with encryption and immutability, and scheduled restore tests so our RTO is measured, not guessed. Replication alone isn't a backup — a bad DELETE replicates instantly."
More on MySQL
How do you set up MySQL and log in to it?BeginnerHow do you create a database, a table and see data in MySQL?BeginnerHow do you create a MySQL user for an application and give it permissions?BeginnerHow do you back up and restore a MySQL database?BeginnerWhat is a relational database?BeginnerWhat is the difference between a database, a table, a row and a column?Beginner