Configuration·MySQL
MySQL Replication Prerequisites
Three servers, three unique ids, GTID on everywhere and one account with exactly one privilege. Every replication problem later is easier when this part is exactly right.
Replication Guide 26 of 45 Intermediate
- OSUbuntu 26.04 LTS
- MySQL8.4.10-0ubuntu0.26.04.1
- ReplicationGTID, ROW format, auto-position
- TimeAbout 15 min
GTID replication is the modern default approach. File-and-position replication still works and is what most older documentation describes; auto-positioning removes the step where you copy coordinates by hand and get them wrong.
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| db-a01 | 192.168.0.81 | Ubuntu 26.04 LTS | Primary / Source / Replica Set Member 1 | 2 Core | 4 GB | 50 GB |
| db-b01 | 192.168.0.82 | Ubuntu 26.04 LTS | Standby / Replica / Replica Set Member 2 | 2 Core | 4 GB | 50 GB |
| db-c01 | 192.168.0.83 | Ubuntu 26.04 LTS | Replica Set Member 3 / Cascading and Delayed Replica | 2 Core | 4 GB | 50 GB |
This guide includes
Use this before configuring any replication at all. This matters because three things have to be true on every server first - a unique id, GTID enabled, and one account with exactly one privilege - and getting them wrong only shows up much later.
- giving every server a unique identity, one drop-in file per host
- validating, and only then restarting all three
- confirming the topology agrees, by asking all three the same question
- creating the replication account, with a single privilege
Before you start
- MySQL installed on all three hosts.
- Network reachability on port 3306, and
bind-addressopen - see the connections guide in the foundations track.
-
Give every server a unique identity
-
Validate, then restart all three
-
Confirm the topology agrees
-
Create the replication account