Documentation Home
MySQL 9.7 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 41.9Mb
PDF (A4) - 42.0Mb
Man Pages (TGZ) - 272.3Kb
Man Pages (Zip) - 378.3Kb
Info (Gzip) - 4.2Mb
Info (Zip) - 4.2Mb


MySQL 9.7 Reference Manual  /  ...  /  Replication and Server SQL Mode

19.5.1.31 Replication and Server SQL Mode

Using different server SQL mode settings on the source and the replica may cause the same INSERT statements to be handled differently on the source and the replica, leading the source and replica to diverge. For best results, you should always use the same server SQL mode on the source and on the replica. This advice applies whether you are using statement-based or row-based replication.

For INTERPRET_UTF8_AS_UTF8MB4, the source records the applicable SQL mode in the binary log for every statement logged using statement format and for every DDL statement, regardless of the binlog_format setting. The replica applies the statement using the recorded mode, so utf8 character set and collation aliases resolve in the same way on the source and replica.

Before a source begins using INTERPRET_UTF8_AS_UTF8MB4, upgrade every replica to a MySQL release that recognizes the mode. Configure the same SQL mode on all servers that may be promoted to source. Otherwise, statements executed locally after a takeover may interpret utf8 aliases differently.

If you are replicating partitioned tables, using different SQL modes on the source and the replica is likely to cause issues. At a minimum, this is likely to cause the distribution of data among partitions to be different in the source's and replica's copies of a given table. It may also cause inserts into partitioned tables that succeed on the source to fail on the replica.

For more information, see Section 7.1.11, “Server SQL Modes”.