Skip to content
On this page

MySQL CDC Reader properties.

Proper configuration of the MySQL server is necessary to use the MySQL adapter. The appropriate configuration steps vary depending on whether MySQL is being used on-premises or Amazon RDS. Please refer to the relevant sections for detailed instructions.

An example MySQL reader configuration with a description of each property is given below:

JSON
"source": {
    "mode": "cdc",
    "type": "mysql",
    "connection": "mysql_user:passw0rd@tcp(1.2.3.4:3306)/Source?tls=true",
    "settings": {
      "flavor": "mysql",
      "sslCA": "../certs/ca.pem",
      "sslCert": "../certs/client-cert.pem",
      "sslKey": "../certs/client-key.pem"
    },
    "filter": {
      "tables": [
        {"name": "products1", "operations": ["insert", "update", "delete"] },
        {"name": "products2", "operations": ["insert", "update", "delete"] }
      ]
    }
  }

General configuration options such as type and filter/tables are described in Source Configuration.

MySQL-specific options.

Connection.

The connection parameter sets up a connection to the MySQL server.

The MySQL Data Source Name (DSN) has a common format but without the type prefix (optional parts marked with square brackets):

[username[:password]@][protocol[(address)]]/dbname[?param1=value1&...&paramN=valueN]

Here is the DSN in its most complete form.

username:password@protocol(address)/dbname?param=value

All values ​​are optional except for the database name. So the minimal DSN is:

/dbname
Description
usernameMySQL User Name to use when connecting to the server.
passwordPassword is a string consisting of any characters.
protocolAs a general rule, you should use a Unix domain socket if available and TCP otherwise for best performance.
addressFor TCP and UDP networks, addresses are host[:port] If no port is specified, the default port 3306 will be used. If host is a literal IPv6 address, it must be enclosed in square brackets. For Unix domain sockets, the address is the absolute path to the MySQL-Server socket, e.g. /var/run/mysqld/mysqld.sock or /tmp/mysql.sock
dbnameThe name of the database to connect to.

Parameters

Parameters follow after ? as key=value pairs.

Parameters are case-sensitive!

Note that parameter values must be escaped. So, for example, you need to replace / with %2F. For example, US/Pacific would be US%2FPacific.

TLS/SSL Connection settings.

To enable an SSL encrypted connection, specify the SSL options in the connection string as follows:

JSON
"connection": "mysql_user:passw0rd@tcp(1.2.3.4:3306)/Source?tls=true",
"settings": {
"sslCA": "../certs/ca.pem",
"sslCert": "../certs/client-cert.pem",
"sslKey": "../certs/client-key.pem"
},

tls attribute values are :

  • true
  • false
  • skip-verify
  • preffered

tls=true enables an encrypted TLS/SSL connection to the server. Use skip-verify if you want to use a self-signed or invalid certificate (on the server side), or use preferred to use TLS only when advertised by the server. This is similar to skip-verify but allows you to fall back to an unencrypted connection. Neither skip-verify nor preferred provides reliable protection.

Path to certificateDescription
sslCAFile containing a list of trusted SSL Certificate Authorities.
sslCertFile containing X.509 certificate
sslKeyFile that containing X.509 key

Flavor.

Flavor can be either mysql or mariadb. If not specified, mysql is used by default.

JSON
"connection": "mariadb_user:passw0rd@tcp(1.2.3.4:3306)/Source",
    "settings": {
      "flavor": "mariadb"
    },

DBConvert Streams - event driven replication for databases