This is a step-by-step guide on how to replicate an existing MySQL server. The server is live and contains data and needs a constant backup companion.
Many tutorials focus on how to setup replication when no data is present on the system. That’s an ideal solution if you’re building a new setup, but in case you’ve got a server that already has data present then here’s how to accomplish the this:
- setup your existing MySQL server (with data) as a Master
- export all your databases and user accounts
- create a slave and import all your data
- start replication
I’ve done this several times and always forgot to take some notes – until today. Without further ado, let’s replicate MySQL.