Replication Features and Issues •A statement invoking a trigger or function that causes an update to an  AUTO_INCREMENT  column is not replicated correctly using statement-based replication. These statements are marked as unsafe. (Bug #45677) •An  INSERT  into a table that has a composite primary key that includes an  AUTO_INCREMENT  column that is not the first column of this composite key is not safe for statement-based logging or replication. These statements are marked as unsafe. (Bug #11754117, Bug #45670) •Adding an  AUTO_INCREMENT  column to a table with  ALTER TABLE  might not produce the same ordering of the rows on the replica and the source. This occurs because the order in which the rows are numbered depends on the specific storage engine used for the table and the order in which the rows were inserted. If it is important to have the same order on the source and replica, the rows must be ordered before assigning an  AUTO_INCREMENT  number. Assuming that you want to add an AUTO_INCREMENT  column to a table  t1  that has columns  col1  and  col2 , the following statements produce a new table  t2  identical to  t1  but with an  AUTO_INCREMENT  column: This issue does not affect tables using the  InnoDB  storage engine, since an  InnoDB  table with an AUTO_INCREMENT column requires at least one key where the auto-increment column is the only or leftmost column. CREATE TABLE t2 LIKE t1; ALTER TABLE t2 ADD id INT AUTO_INCREMENT PRIMARY KEY; INSERT INTO t2 SELECT * FROM t1 ORDER BY col1, col2; Important To guarantee the same ordering on both source and replica, the  ORDER BY clause must name  all  columns of  t1 . The instructions just given are subject to the limitations of  CREATE TABLE ... LIKE : Foreign key definitions are ignored, as are the  DATA DIRECTORY  and  INDEX DIRECTORY  table options. If a table definition includes any of those characteristics, create  t2  using a  CREATE TABLE  statement that is identical to the one used to create  t1 , but with the addition of the  AUTO_INCREMENT  column. Regardless of the method used to create and populate the copy having the  AUTO_INCREMENT  column, the final step is to drop the original table and then rename the copy: DROP t1; ALTER TABLE t2 RENAME t1; See also Section B.3.6.1, “Problems with ALTER TABLE” . The  BLACKHOLE  storage engine accepts data but discards it and does not store it. When performing binary logging, all inserts to such tables are always logged, regardless of the logging format in use. Updates and deletes are handled differently depending on whether statement based or row based logging is in use. With the statement based logging format, all statements affecting  BLACKHOLE  tables are logged, but their effects ignored. When using row-based logging, updates and deletes to such tables are simply skipped— they are not written to the binary log. A warning is logged whenever this occurs. For this reason we recommend when you replicate to tables using the  BLACKHOLE  storage engine that you have the  binlog_format  server variable set to  STATEMENT , and not to either  ROW  or  MIXED . The following applies to replication between MySQL servers that use different character sets: 17.5.1.2 Replication and BLACKHOLE Tables 17.5.1.3 Replication and Character Sets 3655