Introduction
As explained in Chapter 6, Binary Logging, replication enables data from one MySQL database server (the master) to be copied to one or more MySQL database servers (the slaves). Replication is asynchronous by default; slaves do not need to be permanently  connected to receive updates from the master. You can configure to replicate all databases, selected databases, or even selected tables within a database.
In this chapter, you will learn how to set up traditional replication; replicate selected databases and tables; and set up multi-source replication, chain replication, delayed replication, and semi-synchronous replication.
Â
On a high level, replication works like this: all DDL and DML statements executed on a server (master) are logged into binary logs, which are pulled by the servers connecting to it (called slaves). The binary logs are simply copied to the slaves and are saved as relay logs. This process is taken care of by a thread called IO thread. There is one more thread...