MySQL binary logs record every data-changing event. Combined with a full backup, binary logs enable point-in-time recovery (PITR) — the ability to restore a database to any specific moment, not just to the last backup.
How Binary Logs Work
When binary logging is enabled (log_bin = ON in my.cnf), MySQL writes every INSERT, UPDATE, DELETE, and DDL statement to a binary log file. You can replay these logs to apply changes that occurred after the last full backup.
Point-in-Time Recovery Steps
- Restore the last full mysqldump backup
- Identify the binary log files and the target stop time or position
- Replay binary logs using mysqlbinlog up to the desired point
This approach is the standard recovery technique for production databases and allows recovery from accidental data modification right up to the moment before the mistake occurred.