Mysql5.5 master-slave replication of triggers, functions, storage engines, and events.
I. There are three modes for MySQL master-slave replication.
1. binlog_format = row: the log records each row of data in the modified form (record page), and then modifies the same data on the slave side.
2. binlog_format = statement: Each SQL statement that modifies data is recorded in the bin-log of the master. When the Server Load balancer instance is copied, the SQL process will parse the same SQL statement that was previously executed on the master end and execute it again.
3. binlog_format = mixed: This mode is available only after version 5.1.8. mixed is the hybrid mode of row and statement.
Ii. Master-slave replication of the trigger.
A. When binlog_format = statement or binlog_format = mixed (the statement mode is used in mixed Mode)
1. During master-slave replication, the master-slave trigger is subject to the definer clause. Only the master-slave user can run the trigger normally.
2. the SQL statement on the master server is uploaded to the slave server, and the slave server executes the SQL statement to trigger the trigger on the slave server (the description here is: the master server will not pass the triggered SQL statement to the slave server ).
Here we can see that the pass is the original SQL statement.
B. When binlog_format = row or binlog_format = mixed (the mixed mode uses the row mode ),
1. The master server copies the modified page to the slave server, and the modified page value is the changed value after triggering.
2. Because the value of this page is changed after triggering, you do not need this trigger on the slave server.
3. Delete the trigger on the slave server. the same value as the master server can be obtained.