Skip to content

MySQL and MariaDB

MySQL and MariaDB as a source

Setting it up: MySQL and MariaDB.

  • "Unsupported binlog_format=value. binlog_format=ROW required." See Turn on the binary log.
  • "Could not find first log file name in binary log index file": the server removed binlog files the agent hadn't read. See below.
  • "You do not have the SUPER privilege and binary logging is enabled" in the agent's diagnostics: see Let the agent create its function.
  • "Public Key Retrieval is not allowed": see Create the agent user.
  • Allow Incremental Replication from this Source is unavailable when you create the SQDR source: the source's user can't read the agent's SQ_PROPERTIES table. See Give SQDR access to the control tables.
  • A new baseline never finishes synchronizing (the subscription's green icon keeps a black dot): check binlog-do-db and binlog-ignore-db (see Turn on the binary log).

"Could not find first log file name in binary log index file"

The agent's Diagnostics tab shows:

MySqlLogReader.onCommunicationFailure: com.github.shyiko.mysql.binlog.network.ServerException:
Could not find first log file name in binary log index file

Cause: the server removed the binlog file the agent was reading, before the agent had read it, for example while the agent was stopped (see Keep the binary log long enough).

What to do: the changes in the removed files are lost. Move the agent's read position to the present:

  1. Stop the agent, set its startup mode to Warm (restored) (see Startup mode), and start it.
  2. Run new baselines for the subscriptions whose tables changed while the files were missing.

To start from a binlog file and position of your choice instead, see Read the log again from an earlier point. Then keep the files longer, so that it doesn't happen again.

"Unknown ODBC error" or "Invalid cursor state" in the subscription wizard

Creating a subscription from a MySQL source fails after the Criteria step, while the wizard reads the table's columns, with "Unknown ODBC error" or "Invalid cursor state".

Cause: MySQL Connector/ODBC 8.0.28 and later, used for the SQDR source.

What to do: connect the SQDR source with the MariaDB ODBC driver, or with MySQL Connector/ODBC 8.0.27 (see Create the SQDR source).

Creating an index at a Db2 for i destination fails: the name exists

With a Db2 for i destination, the Replicator Service can't create some of the source's indexes: an index of the same name already exists in the schema.

Cause: in MySQL an index name only needs to be unique for its table: ap_vendor.vendor and po_vendor.vendor are two indexes named vendor. On Db2 for i, index names are unique in the schema, and share the schema's names with the tables, so a schema can't hold both a table and an index named abc.

What to do: give the source indexes names that are unique in the schema, for example the table name followed by the index name (ap_vendor_vendor). Such names work in MySQL too.

See also:

For any other message, see Error messages.

MySQL and MariaDB as a destination

Setting it up: MySQL and MariaDB.

"MySQL server has gone away"

Inserting rows fails with a message such as Insert failed at destination. [MySQL][ODBC 8.0(w) Driver][mysqld-8.0.17]MySQL server has gone away, for example for a table with large LOB values (a 4.5 MB video in the case seen).

Cause: a statement is larger than the server's max_allowed_packet (see Server settings).

What to do: raise max_allowed_packet on the destination server, for example to 100 MB:

SET GLOBAL max_allowed_packet = 104857600;

To keep the value after a restart, also set it in the server's configuration file. Or choose Insert using ODBC for the subscription.

"Attempt to recover subscription failed(Cleanup.) Unexpected Exception encountered during Replication"

A baseline to a MySQL or MariaDB destination fails with this message for some tables, depending on their content. It was seen with long VARCHAR columns (such as VARCHAR(3500)), including CLOB columns mapped to them. To confirm it, leave the column out of the subscription: the replication then succeeds.

Cause: the native loader sends many rows in one INSERT statement, and some content makes that statement fail.

What to do: either:

  • choose Insert using ODBC instead of Use native-loader function, if available in the subscription's Baseline Replication Options (slower, especially over a WAN); or
  • lower the maxMySQLParms service property (2000 by default), so that each statement holds fewer rows. No value fits every case, and inserts get a little slower.

Other problems