For statement-based logging, you can create the columns as follows:
- Create the table on the master
CREATE TABLE t1 (a INT, b INT);
- Alter the table on the slave:
ALTER TABLE t1 ADD ts TIMESTAMP;
- Sample insert on the master:
INSERT INTO t1(a,b) VALUES (10,20);
For row-based logging, you must make the new columns appear at the end of the row and have default values. Row-based replication will fail if you add columns in the middle or at the front of the row. As long as you add columns at the end of the table and give them default values, no special consideration needs to be taken regarding which statements to use when replicating, since row-based replication will extract the columns directly from the row being updated, inserted, or deleted.




Help





