Replication Compatibility Between MariaDB and MySQL
Contents
This page describes replication compatibility between MariaDB and MySQL. For replication compatibility details between different MariaDB versions, see Cross-Version Replication Compatibility.
Replication Compatibility
Replication compatibility depends on:
- The MariaDB version
- The MySQL version
- The role of each server
Replicating from MySQL to MariaDB
MySQL 5.7
MariaDB 10.2 and later can replicate from a MySQL 5.7 primary server.
MariaDB does not support the MySQL implementation of Global Transaction IDs (GTIDs), so the MariaDB replica server must use the binary log file and position for replication. If GTID mode is enabled on the MySQL primary server, the MariaDB replica server will remove the MySQL GTID events and replace them with MariaDB GTID events.
Although MariaDB and MySQL 5.7 are compatible at the replication level, they may have some incompatibilities at the SQL level. Those differences can cause replication failures in some cases. To decrease the risk of compatibility issues, it is recommended to set binlog_format to ROW
. When you want to replicate from MySQL 5.7 to MariaDB, it is recommended to test your application, so that any compatibility issues can be found and fixed.
MySQL 8.0
Before MariaDB 10.6.21, MariaDB Server could not replicate from a MySQL 8.0 primary server, because MySQL 8.0 has a binary log format that is incompatible.
MariaDB 10.6.21 and newer can replicate from a MySQL 8.0 server as long as the following holds:
- Columns of type JSON are not supported. One should change these to TEXT.
- One should set
binlog-row-value-options=""
. This disables the incompatiblePARTIAL_UPDATE_ROWS_EVENT
event. - One should set
binlog_transaction_compression=0
. This disables the incompatibleTRANSACTION_PAYLOAD_EVENT
event. - One should not use the MySQL 8.0 utf8mb4_ja_0900_... collations when replicating to MariaDB 10.6 - MariaDB 11.4.4. MariaDB 11.4.5 and above will support most of the MySQL 8.0 utf8mb4_ja_0900_... collations.
Replicating from MariaDB to MySQL
When replicating from MariaDB to MySQL, one should:
- Not use binlog with global transaction ids (CHANGE SOURCE_AUTO_POSITION=no)
- Not use binlog encryption (--encrypt-binlog=0)
- Not use binary log compression (--log-bin-compress=0)
- Ensure that one uses a character set that MySQL supports. The MariaDB default character set utf8mb4 is not supported by MySQL.