The easiest and most straightforward method for setting up replication is to use new source and replica servers.
You can also use this method if you are setting up new servers but have an existing dump of the databases from a different server that you want to load into your replication configuration. By loading the data into a new source, the data is automatically replicated to the replicas.
To set up replication between a new source and replica:
Configure the MySQL source with the necessary configuration properties. See Section 2.1.1, “Setting the Replication Source Configuration”.
Start up the MySQL source.
Set up a user. See Section 2.1.3, “Creating a User for Replication”.
Obtain the source's status information, or a copy of the source's binary log index file made during a shutdown for the data snapshot. See Section 2.1.4, “Obtaining the Replication Source Binary Log Coordinates”.
On the source, release the read lock:
mysql> UNLOCK TABLES;
On the replica, edit the MySQL configuration. See Section 2.1.2, “Setting the Replica Configuration”.
Start up the MySQL replica server.
CHANGE MASTER TOstatement to set the replication source server configuration. See Section 2.1.10, “Setting the Source Configuration on the Replica”.
Perform the replica setup steps on each replica.
Because there is no data to load or exchange on a new server configuration you do not need to copy or import any information.
If you are setting up a new replication environment using the data from a different existing database server, you must now run the dump file generated from that server on the new source. The database updates are automatically propagated to the replicas:
$> mysql -h source < fulldb.dump