In this section, setting up of single slave is explained. The same principles can be applied to set up chain replication. Usually the backups are taken from the slave when setting up another slave.
Outline:
- Enable binary logging on the master
- Create a replication user on the master
- Set the unique server_id on the slave
- Take backup from the master
- Restore the backup on the slave
- Execute the CHANGE MASTER TO command
- Start the replication
Steps:
- On master: Enable binary logging on the master and set SERVER_ID. Refer to Chapter 6, Binary Logging, to learn how to enable binary logging.
- On master: Create a replication user. The slave connects to the master using this account:
mysql> GRANT REPLICATION SLAVE ON *.* TO 'binlog_user'@'%' ...