Skip to content
Open Data Sync ↗

MySQL

Data Sync reads MySQL as a source: it backfills the tables you select, then streams every insert, update and delete from the server's binary log. There is no MySQL sink.

Source Binary log GTID

Overview

MySQL records every committed change in its binary log. Data Sync reads that log rather than polling your tables, so each change is seen once, in commit order, and nothing is written into your schema. The connector covers MySQL and MySQL-compatible servers.

By default Data Sync tracks its position in the log by GTID, MySQL's global transaction identifier. A GTID position survives a failover to a replica, which a binary-log file name and offset does not.

Before you connect

Do this on the server first. A connection can test green and still be unable to stream if the binary log is not set up for row-level capture.

  1. Turn on row-based binary logging. Binary logging must be enabled (it is by default in MySQL 8) with binlog_format = ROW. Statement-based logging does not record the rows a change touched.
  2. Log whole rows. Set binlog_row_image = FULL. With MINIMAL, an update records only the columns that changed.
  3. Turn on GTIDs, or switch them off in Data Sync. The connection's GTID mode is on by default, which needs gtid_mode = ON and enforce_gtid_consistency = ON on the server. If your server does not use GTIDs, set GTID mode to false on the connection.
  4. Keep the log long enough. If Data Sync is stopped for longer than binlog_expire_logs_seconds, the log it needs to resume from has been purged and the sync cannot pick up where it stopped.
  5. Create a user for Data Sync that can read the tables and read the binary log.
-- my.cnf binlog_format = ROW binlog_row_image = FULL gtid_mode = ON enforce_gtid_consistency = ON
-- a user Data Sync can replicate with CREATE USER 'pulse'@'%' IDENTIFIED BY '…'; GRANT SELECT ON shop.* TO 'pulse'@'%'; GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'pulse'@'%';

Connection fields

Set once, on the connection, in step 2 of the add-a-connection wizard.

FieldDefaultDescription
hostRequired—Hostname or address of the MySQL server.
portOptional3306TCP port.
databaseOptional—The database (schema) to read from.
gtid_modeOptionaltrueTrack the log position by GTID. Set to false for servers without GTIDs.
tls_modeOptionalnoneOne of none, require, verify-ca, verify-full. Use verify-full whenever the connection crosses a network you do not control.
reconnect_budgetAdvanced15mHow long Data Sync keeps trying to re-establish a dropped connection before the run fails.
max_reconnect_attemptsAdvanced—A cap on reconnect attempts within that budget.

Credentials

Step 3 asks for the user and password, both required. Store them as a Blunox-managed secret or as a reference to your own secret store; the connection keeps a reference, never the value. See Connections for how the two options differ.