Guide

MySQL CDC: change data capture from the MySQL binlog

MySQL CDC reads the binary log, the record of every change MySQL commits, and turns it into events. This guide covers the binlog settings it needs, why GTIDs matter, how long the binlog must be kept, how snapshots lock tables, and what changes on RDS and Aurora.

45 minutes with an engineer: we review your workload and sketch the design.

  • Docs read 19 Nov 2026
  • OSStend runs Debezium

MySQL CDC reads row changes from the binary log. It needs row-based logging with full row images, binlog retention longer than any connector outage, and a reader that joins as a replica with its own server id. GTIDs make it easier to resume after a failover. Facts read from the MySQL, Debezium and AWS documentation, 19 Nov 2026.

Customers

  • Microsoft logo
  • Henry Schein logo
  • Enbridge logo
  • Gojek logo

Partners

  • Broadcom logo
  • Redis logo
  • VMware Tanzu logo
  • OSSeva logo

What is MySQL CDC?

MySQL CDC (change data capture) is reading the row changes MySQL writes to its binary log and sending them to other systems as they happen. A CDC reader connects the way a replica does, reads the binlog from a stored position and emits one event per changed row.

Because the reader behaves like a replica, the same settings that make MySQL replication reliable make CDC reliable: row-based logging, a unique server id, enough binlog retention and, ideally, GTIDs. For the general methods and tools, read change data capture explained; the PostgreSQL equivalent is the Postgres CDC guide.

Binlog settings MySQL CDC needs

MySQL CDC needs the binary log in ROW format with FULL row images, so each event carries the whole row before and after the change. Retention has to outlast the longest time a connector might be down, or the changes in between are lost to it.

VariableDefault and optionsFor CDC
binlog_formatROW (default), STATEMENT or MIXED; the variable is deprecated in MySQL 8.4 and the manual says new setups should use row-based logging only (binary log options, checked 19 Nov 2026).ROW.
binlog_row_imagefull (default), minimal or noblob.FULL; Debezium requires it (Debezium MySQL connector, checked 19 Nov 2026).
binlog_row_metadataMINIMAL (default) or FULL; FULL adds column names, ENUM and SET strings and primary key information.FULL helps readers that rely on binlog metadata.
binlog_expire_logs_seconds2592000, which is 30 days; 0 disables automatic purging, and binlog_expire_logs_auto_purge is ON by default.Longer than the longest connector outage the design allows.
server_idEvery server and reader in a replication topology needs a unique id.The connector's database.server.id must be unique across the cluster, because it joins as another server.

The server side of a CDC-ready MySQL 8.4, with illustrative values:

my.cnf (example)
[mysqld]
server_id                  = 101
log_bin                    = mysql-bin
binlog_format              = ROW          # deprecated variable; ROW is the default
binlog_row_image           = FULL
binlog_expire_logs_seconds = 604800       # 7 days: longer than any planned outage
gtid_mode                  = ON
enforce_gtid_consistency   = ON
45 minutes with an engineer: we review your workload and sketch the design, then price it.

GTIDs and resuming after a failover

A GTID names each transaction uniquely across the whole topology and keeps that name on every replica. A CDC reader that tracks GTIDs can resume on a promoted replica by comparing GTID sets, instead of translating a binlog file name and offset that only meant something on the old primary.

What GTIDs give.
A replica compares GTID sets instead of tracking binlog file names and offsets (GTID concepts, checked 19 Nov 2026). Debezium says GTIDs are not required but simplify things (Debezium MySQL connector, checked 19 Nov 2026).
Turning them on.
enforce_gtid_consistency=ON comes first; gtid_mode then moves OFF, OFF_PERMISSIVE, ON_PERMISSIVE, ON, one step at a time. Both are dynamic, so it is an online change done in order (GTID options, checked 19 Nov 2026).
Failover plan.
The design states which replica a connector moves to after a failover, and that replica keeps the same binlog retention as the primary.

Initial snapshots, locks and incremental snapshots

Before streaming, a CDC connector usually copies the existing rows. Debezium's default takes a global read lock only while it reads the schema, then reads rows inside a consistent transaction; on RDS and Aurora, where global read locks are not allowed, it falls back to table locks.

  • Locking modes. snapshot.locking.mode is minimal by default: the global read lock is held only while schemas are read, then rows are read in a REPEATABLE READ transaction. extended blocks writes for the whole snapshot, and none takes no locks and is safe only when no schema changes happen meanwhile; MyISAM tables are always locked (Debezium MySQL connector, checked 19 Nov 2026).
  • Privileges. The connector user needs SELECT, RELOAD, SHOW DATABASES, REPLICATION SLAVE and REPLICATION CLIENT, plus LOCK TABLES on services that disallow a global read lock, such as RDS and Aurora.
  • Incremental snapshots. Tables can be snapshotted again in chunks while streaming continues, triggered through a signaling table named in signal.data.collection. That is how a table is re-read after a gap without stopping the pipeline.

The schema history topic: why it matters for MySQL CDC

The binlog records row changes, not the table definition each row had. Debezium keeps the DDL it has seen in a schema history topic, so it can interpret every binlog event with the schema that applied at that position. Lose or damage that topic and the connector cannot resume cleanly.

One partition, internal use.
schema.history.internal.kafka.topic is for the connector only and must never be partitioned, because it needs a single partition for global order (Debezium MySQL connector, checked 19 Nov 2026).
Retention.
The topic keeps its records indefinitely and is replicated, and it is part of the backup and DR plan alongside the connector offsets.
Schema changes.
DDL on captured tables is reviewed before it runs, because it lands in this history and in every consumer's view of the table.

MySQL CDC on Amazon RDS and Aurora MySQL

RDS for MySQL purges binlogs almost at once unless you set a retention period, and Aurora MySQL has binary logging off until you turn it on. Both need changes before a CDC connector can work reliably.

RDS for MySQL retention.
binlog retention hours is NULL by default, meaning binlogs are not kept; set it with CALL mysql.rds_set_configuration('binlog retention hours', 24). Zero is not allowed and the maximum on RDS for MySQL is 168 hours, 7 days (RDS documentation, checked 19 Nov 2026).
Aurora MySQL.
Binary logging is off by default; set binlog_format in a custom DB cluster parameter group and reboot when changing it from OFF. Retention defaults to 24 hours if unset, up to 2160 hours (90 days) on Aurora MySQL 2.11.0 and later and version 3 (Aurora documentation, checked 19 Nov 2026).
Locks.
Both disallow global read locks, so Debezium snapshots use table-level locks and the user needs LOCK TABLES.
Sizing retention.
The 7-day ceiling on RDS for MySQL is the longest a connector can be down there without a re-snapshot, so alerting has to fire well inside it.

MySQL versions, MariaDB and CDC tools

MySQL now ships long-term-support releases, such as 8.4, beside short-lived Innovation releases. Debezium 3.7 supports MySQL 8.0, 8.4 and 9.7, and MariaDB has its own Debezium connector.

Release model.
LTS releases get only necessary fixes, with 5 years of premier and 3 of extended support; Innovation releases are supported until the next one (MySQL releases, checked 19 Nov 2026).
Supported by Debezium 3.7.
MySQL 8.0.x, 8.4.x and 9.7, and MariaDB 11.4.x, 11.8.x and 12.3 through the separate MariaDB connector (Debezium releases, checked 19 Nov 2026).
Running it.
Debezium usually runs on Kafka Connect into Kafka; OSStend runs the whole pipeline as managed Debezium, and the database as managed MySQL. Other tools are compared on Debezium alternatives.

From our on-call engineers: the MySQL CDC checks in our runbook

These come from the MySQL, Debezium and AWS documentation, read on 19 Nov 2026, and are the checks we build a MySQL CDC runbook from. They are documentation, not a record of incidents, and we quote no customer figure.

  • binlog_row_image is confirmed as FULL on the server the connector reads, and on every replica it could fail over to.
  • Binlog retention is compared against the alert threshold for connector downtime, with a margin, on every source.
  • On RDS for MySQL, binlog retention hours is set explicitly, since the default keeps nothing.
  • Each connector's server id is checked against every replica and every other reader.
  • The schema history topic has one partition and is in the backup plan with the offsets.
  • GTIDs are switched on in their documented order, never by jumping straight from OFF to ON.

FAQ

What is MySQL CDC?

Reading the row changes MySQL writes to its binary log and sending each one to other systems as an event, by connecting the way a replica does.

Which binlog format does MySQL CDC need?

ROW, with binlog_row_image set to FULL. ROW is the default in current MySQL, and Debezium requires FULL row images.

How long should the binlog be kept for CDC?

Longer than the longest time a connector could be down before someone fixes it. MySQL's default is 30 days; RDS for MySQL keeps nothing until you set binlog retention hours, up to 7 days.

Does MySQL CDC need GTIDs?

Not strictly, but GTIDs make it much simpler for a connector to resume on a different server after a failover.

Does a MySQL CDC snapshot lock my tables?

With Debezium's default, a global read lock is held only while schemas are read. On RDS and Aurora, which disallow global read locks, table locks are used instead.

Can I do MySQL CDC on Aurora?

Yes, after turning on binary logging with binlog_format in a custom DB cluster parameter group and setting retention.

What reads the MySQL binlog for CDC?

Debezium is the common open-source choice, on Kafka Connect or Debezium Server. Managed services such as AWS DMS read it too. See Debezium alternatives.

MySQL is a trademark of Oracle Corporation and MariaDB a trademark of MariaDB plc. Debezium is a trademark of its respective owner, and Apache Kafka a trademark of The Apache Software Foundation. AWS, Amazon RDS and Aurora are trademarks of Amazon. OSStend is not affiliated with or endorsed by these companies or projects.

Talk to an engineer

Take your MySQL CDC pipeline to an engineer

45 minutes: your binlog settings, retention and connectors are reviewed, and an engineer says what to change and what to hand over.

  • A design sketch for your workload, not a plan menu
  • A zero-downtime cutover path for what you run today
  • A price for that design, after the review
See pricing →

Your request goes to the OSStend team. No newsletter sign-up.

Get a quoteTalk to an engineer
2Engines Optional
3Where should it run?
4What do you need?

Your request goes to the OSStend team. No newsletter sign-up.