Databases 4 min read

What’s the Difference Between MySQL Redo Log and Binlog? (Interview Insight)

The article explains that MySQL redo log operates at the InnoDB engine layer to ensure transaction durability and crash recovery, while binlog works at the server layer to record logical changes for replication, archiving, and point‑in‑time recovery, highlighting their distinct layers, purposes, content, and write mechanisms.

Architect Chen
Architect Chen
Architect Chen
What’s the Difference Between MySQL Redo Log and Binlog? (Interview Insight)

1. Different Levels

redo log

is the InnoDB storage‑engine‑level log and only affects InnoDB. It primarily supports transaction commit and crash‑recovery mechanisms. binlog is the MySQL server‑level log and does not depend on a specific storage engine. Any data change executed by the server is typically recorded in binlog.

UPDATE user SET age = 20 WHERE id = 1;

2. Different Functions

redo log

’s core function is to guarantee transaction durability (the D in ACID). It follows Write‑Ahead Logging: when an InnoDB data page has not yet been flushed to disk, the modification is first written to the redo log, allowing the system to redo committed transactions after a crash. binlog ’s core function is data archiving, master‑slave replication, and point‑in‑time recovery. It records the logical SQL change process, making it easy for replicas to replay the master’s operations or to recover data after accidental deletion.

Write Ahead Logging (WAL)

3. Different Recorded Content

redo log

records physical changes, focusing on page‑level modifications. Because it deals with low‑level data, the log size is small and writes are fast. binlog records logical changes, usually the executed SQL statements or row events. This logical representation aligns with business semantics and is convenient for replay in different environments.

4. Different Write Timing and Persistence

redo log

is written in a circular buffer (ring buffer) with a fixed space; when the buffer is full it overwrites old entries. During a transaction, InnoDB first writes modifications to the redo‑log buffer and then flushes it according to a configured policy.

redolog:循环写(Ring Buffer)
binlog

is appended sequentially to log files that grow until a size limit, after which a new file is created. It is usually flushed at transaction commit, preserving a global change record.

写 redo log(prepare 状态)2. 写 binlog 3. redo log 提交(commit)
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

InnoDBmysqlBinlogReplicationredo logcrash recoverytransaction durability
Architect Chen
Written by

Architect Chen

Sharing over a decade of architecture experience from Baidu, Alibaba, and Tencent.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.