Restart Master-Master Replication

Before you begin, identify the “good” server. This will be the most up-to-date master server.

Now, follow the steps below.

Good Server:

Note: Tables will be locked when running this command.

Copy this file (found in the MySQL bin directory) to the same directory on the bad server.

Bad Server:

Check that both the Slave_IO_Running and Slave_SQL_Running processes are running.

They should automatically restart after the dump.sql file is imported. If this does not happen then run the following command.

Flush and lock tables… and then check the master status.

Make a note of the File and Position values.

Good Server:

Replace the master_log_file and master_log_pos values with those recorded in the previous step and then run these commands.

Check the status of the slave to ensure that replication is working.

Bad Server:

The Master-Master replication has now been restarted!

To gain a general overview of the process, I found this article useful.

My method focuses on fixing Master-Master replication for an entire server (instead of just one database) running within a Windows environment.

Depending on how often replication breaks, I may write a quick PowerShell script to automate things a little.