MySQL Master to Slave Replication – Will Altering Column Name Be Replicated?

mysql-5.7replication

I have a replicated MySQL database that until recently was supported by a DBA. Unfortunately, he has now left so we're playing catch up.

From what I can tell the replication that is set up is:

  • binary_log based (i.e. not GTID)
  • row based
  • the table being altered is InnoDB

I'm basing this on a few things

  1. The output from SHOW SLAVE STATUS references the binary log
  2. The mysql.gtid_executed table on the master and slave are both empty
  3. The output from SHOW GLOBAL VARIABLES LIKE 'binlog_format'; is ROW

The master server is using MySQL version 5.7.9. The slave is using MySQL version 5.7.17

If I change a column name in the master database using the command

ALTER TABLE table_name CHANGE COLUMN old_column_name new_column_name DATETIME NOT NULL 

will the change be replicated to the slave?

Or do I need to change the column name in the slave as well?

Best Answer

I was able to test this on our replicated environment.

Surprisingly, the column name was updated in the slave environment. I assumed this would not be the case because the row-based replication was configured.