Documentation Home
MySQL 5.6 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 31.2Mb
PDF (A4) - 31.3Mb
PDF (RPM) - 29.6Mb
HTML Download (TGZ) - 7.3Mb
HTML Download (Zip) - 7.3Mb
HTML Download (RPM) - 6.3Mb
Man Pages (TGZ) - 180.4Kb
Man Pages (Zip) - 290.5Kb
Info (Gzip) - 3.0Mb
Info (Zip) - 3.0Mb
Excerpts from this Manual

MySQL 5.6 Reference Manual  /  ...  /  Setting Up Replication with New Master and Slaves Setting Up Replication with New Master and Slaves

The easiest and most straightforward method for setting up replication is to use new master and slave 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 master, the data will be automatically replicated to the slaves.

To set up replication between a new master and slave:

  1. Configure the MySQL master with the necessary configuration properties. See Section, “Setting the Replication Master Configuration”.

  2. Start up the MySQL master.

  3. Set up a user. See Section, “Creating a User for Replication”.

  4. Obtain the master status information, or a copy of the master's binary log index file made during a shutdown for the data snapshot. See Section, “Obtaining the Replication Master Binary Log Coordinates”.

  5. On the master, release the read lock:

    mysql> UNLOCK TABLES;
  6. On the slave, edit the MySQL configuration. See Section, “Setting the Replication Slave Configuration”.

  7. Start up the MySQL slave.

  8. Execute a CHANGE MASTER TO statement to set the master replication server configuration. See Section, “Setting the Master Configuration on the Slave”.

Perform the slave setup steps on each slave.

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 will now need to run the dump file generated from that server on the new master. The database updates will automatically be propagated to the slaves:

shell> mysql -h master < fulldb.dump