To connect to a master for replication, run the CHANGE MASTER command with the necessary connection information of the master.

1. Run the command below to connect to Server 1, replacing the option values with the actual values we got from the master server 1:

mysql> CHANGE MASTER TO MASTER_HOST='192.168.0.11', MASTER_USER='replicator', MASTER_PASSWORD='password', MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=107 FOR CHANNEL 'Server-1';
  • MASTER_HOST='IP Address of the master server'
  • MASTER_USER='replicator'
  • MASTER_PASSWORD='password'
  • MASTER_LOG_FILE='Name of the binary log file on the master server '
  • MASTER_LOG_POS=Position of the binary log file on the master server
  • FOR CHANNEL 'Name of the connection channel'

2. Repeat the above process for each other master that we want to connect to, changing the host IP address, binary log info and channel as appropriate.

3. Finally start the slave thread.

mysql> START SLAVES;
  • No labels