MySQL package upgrades (Debian apt-get) always break master-master replication due to changes in mysql schema

Solution 1:

it would be nice to know what commands broke your replication, but I suppose, the mysql_upgrade script would be that rogue. If yes, you can rebuild the mysql package, adding to the post install script a --skip-write-binlog (this is not needed after 5.6.7)

But normally I never would just apt-get upgrade a server which is in production, stop the slave, upgrade it and reconnect them. This is the zen way.

Solution 2:

I don't know if it will work for every possible upgrade scenario, but I just tested this, and the upgrade worked without any replication problems:

# /etc/mysql/conf.d/binlog_ignoredb_mysql.cnf.disabled
# Rename this to end in .cnf prior to performing `apt-get upgrade`.
# Otherwise, its attempts to `ALTER TABLE users` will cause replication errors.
# After upgrade is complete, rename back to .disabled and then /etc/init.d/mysql restart


Note that my test was on a minor upgrade (5.5.41 to 5.5.43).