SyntaxStudy
Sign Up
MySQL Failover and Promotion
MySQL Advanced 5 min read

Failover and Promotion

Failover

When the primary fails, promote a replica to primary. With GTID, the process is straightforward. Always verify replicas are caught up before promotion.

Example
-- On the replica to promote:
STOP REPLICA;
RESET REPLICA ALL;  -- remove connection to old primary
-- Verify all GTIDs applied
SHOW VARIABLES LIKE "gtid_executed";
-- Reconfigure application connection strings to point to new primary
-- Point remaining replicas to new primary:
CHANGE REPLICATION SOURCE TO
  SOURCE_HOST="new_primary",
  SOURCE_AUTO_POSITION=1;
START REPLICA;
Pro Tip

Orchestrator, MHA, or InnoDB Cluster automate failover — manual promotion is error-prone under pressure.