16.1.3 Replication and Binary Logging Options and Variables

16.1.3.1 Replication and Binary Logging Option and Variable Reference
16.1.3.2 Replication Master Options and Variables
16.1.3.3 Replication Slave Options and Variables
16.1.3.4 Binary Log Options and Variables

The next few sections contain information about mysqld options and server variables that are used in replication and for controlling the binary log. Options and variables for use on replication masters and replication slaves are covered separately, as are options and variables relating to binary logging. A set of quick-reference tables providing basic information about these options and variables is also included (in the next section following this one).

Of particular importance is the --server-id option.

Command-Line Format--server-id=#
Option-File Formatserver-id
System Variable Nameserver_id
Variable ScopeGlobal
Dynamic VariableYes
 Permitted Values
Typenumeric
Default0
Range0 .. 4294967295

This option is common to both master and slave replication servers, and is used in replication to enable master and slave servers to identify themselves uniquely. For additional information, see Section 16.1.3.2, “Replication Master Options and Variables”, and Section 16.1.3.3, “Replication Slave Options and Variables”.

On the master and each slave, you must use the --server-id option to establish a unique replication ID in the range from 1 to 232 – 1. Unique, means that each ID must be different from every other ID in use by any other replication master or slave. Example: server-id=3.

If you omit --server-id, the default ID is 0, in which case the master refuses connections from all slaves, and slaves refuse to connect to the master. In MySQL 5.1, whether the server ID is set to 0 explicitly or the default is allowed to be used, the server sets the server_id system variable to 1; this is a known issue that is fixed in MySQL 5.7.

For more information, see Section 16.1.1.2, “Setting the Replication Slave Configuration”.