Set the relationship between the master and slave binlog_format.
1. The master database is row, and the slave database must be row/mixed. If statement is used, the slave database reports the following error when the master database changes (no matter what changes, such as insert/update/delete/alter ):
Last_Error: Error executing row event: 'Could not execute statement: impossible to write to binary log since statement is in row format and BINLOG_FORMAT = STATEMENT. '2. the master database is statement and the slave database can be in any mode (statement, mixed, or row), but data inconsistency may occur. Therefore, it is not recommended to use this mode.
3. The master database is mixed, and the slave database must be in row/mixe format. If the slave database is statement, the master database generally modifies the data and does not report an error. In special cases, the slave database reports the following error.
Last_Error: Error executing row event: 'Could not execute statement: impossible to write to binary log since statement is in row format and BINLOG_FORMAT = STATEMENT. 'The General situation mentioned above is that the master database records binlog in the statement format. The special case mentioned above is that the master database records the binlog in the row format. Specific to the following types:
(1) when using the UUID () function
(2) when one or more tables with AUTO_INCREMENT columns are updated and 'trigger' or 'stored function' is called
(3) Executing INSERT DELAYED
(4) When a part of a view needs row-based replication (for example, UUID (), the statement used to create the view is changed to row-based.
(5) When using user-defined functions (udfs)
(6) When a statement is determined to be row-based and its session needs to use a temporary table, all sub-statements in the session will be recorded in the ROW format.
(7) When using USER (), CURRENT_USER () or CURRENT_USER
(8) When the statement references one or more system variables.
(9) When LOAD_FILE () is used ()
For details about how mysql records mixed as row, see the official documentation:
Https://dev.mysql.com/doc/refman/5.7/en/binary-log-mixed.html