MySQL
Airbyte's certified MySQL connector offers the following features:
- Multiple methods of keeping your data fresh, including Change Data Capture (CDC) using the binlog.
- All available sync modes, providing flexibility in how data is delivered to your destination.
- Reliable replication at any table size with checkpointing and chunking of database reads.
The contents below include a 'Quick Start' guide, advanced setup steps, and reference information (data type mapping and changelogs).
Please note the minimum required platform version is v0.58.0 to run source-mysql 3.4.0.
Quick Start
Here is an outline of the minimum required steps to configure a MySQL connector:
- Create a dedicated read-only MySQL user with permissions for replicating data
- Create a new MySQL source in the Airbyte UI using CDC logical replication
- (Airbyte Cloud Only) Allow inbound traffic from Airbyte IPs
Once this is complete, you will be able to select MySQL as a source for replicating data.
Step 1: Create a dedicated read-only MySQL user
These steps create a dedicated read-only user for replicating data. Alternatively, you can use an existing MySQL user in your database.
The following commands will create a new user:
CREATE USER <user_name> IDENTIFIED BY 'your_password_here';
Now, provide this user with read-only access to relevant schemas and tables:
GRANT SELECT, RELOAD, SHOW DATABASES, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO <user_name>;
If choosing to run using the STANDARD
replication method (not recommended), only the SELECT
permission is required.
Step 2: Enable binary logging on your MySQL server
You must enable binary logging for MySQL replication using CDC. Most cloud providers (AWS, GCP, etc.) provide easy one-click options for enabling the binlog on your source MySQL database.
If you are self-managing your MySQL server, configure your MySQL server configuration file with the following properties:
Configuring MySQL server config files to enable binlog
server-id = 223344
log_bin = mysql-bin
binlog_format = ROW
binlog_row_image = FULL
binlog_expire_logs_seconds = 864000
- server-id : The value for the server-id must be unique for each server and replication client in the MySQL cluster. The
server-id
should be a non-zero value. If theserver-id
is already set to a non-zero value, you don't need to make any change. You can set theserver-id
to any value between 1 and 4294967295. For more information refer mysql doc - log_bin : The value of log_bin is the base name of the sequence of binlog files. If the
log_bin
is already set, you don't need to make any change. For more information refer mysql doc - binlog_format : The
binlog_format
must be set toROW
. For more information refer mysql doc - binlog_row_image : The
binlog_row_image
must be set toFULL
. It determines how row images are written to the binary log. For more information refer mysql doc - binlog_expire_logs_seconds : This is the number of seconds for automatic binlog file removal. We recommend 864000 seconds (10 days) so that in case of a failure in sync or if the sync is paused, we still have some bandwidth to start from the last point in incremental sync. We also recommend setting frequent syncs for CDC.
Step 3: Create a new MySQL source in Airbyte UI
From your Airbyte Cloud or Airbyte Open Source account, select Sources
from the left navigation bar, search for MySQL
, then create a new MySQL source.
To fill out the required information:
- Enter the hostname, port number, and name for your MySQL database.
- Enter the username and password you created in Step 1.
- Select an SSL mode. You will most frequently choose
require
orverify-ca
. Both of these always require encryption.verify-ca
also requires certificates from your MySQL database. See here to learn about other SSL modes and SSH tunneling. - Select
Read Changes using Binary Log (CDC)
from available replication methods.
Step 4: (Airbyte Cloud Only) Allow inbound traffic from Airbyte IPs.
If you are on Airbyte Cloud, you will always need to modify your database configuration to allow inbound traffic from Airbyte IPs. You can find a list of all IPs that need to be allowlisted in our Airbyte Security docs.
Now, click Set up source
in the Airbyte UI. Airbyte will now test connecting to your database. Once this succeeds, you've configured an Airbyte MySQL source!