Documentation Home
MySQL Replication
Related Documentation Download this Excerpt
PDF (US Ltr) - 0.9Mb
PDF (A4) - 0.9Mb
HTML Download (TGZ) - 278.3Kb
HTML Download (Zip) - 293.1Kb


MySQL Replication  /  Replication Configuration  /  Replication and Binary Logging Options and Variables

2.3 Replication and Binary Logging 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 system variable.

Property Value
Command-Line Format --server-id=#
System Variable server_id
Scope Global
Dynamic Yes
Type Integer
Default Value 0
Minimum Value 0
Maximum Value 4294967295

This variable specifies the server ID.

On a replication master and each replication slave, you must specify server_id 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. For additional information, see Section 2.3.2, “Replication Master Options and Variables”, and Section 2.3.3, “Replication Slave Options and Variables”.

If you do not specify server_id, the default server ID is 0. If the server ID is set to 0, binary logging takes place, but a master with a server ID of 0 refuses any connections from slaves, and a slave with a server ID of 0 refuses to connect to a master. Note that although you can change the server ID dynamically to a nonzero value, doing so does not enable replication to start immediately. You must change the server ID and then restart the server to initialize the replication slave.

In MySQL 5.5, 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 2.1.2, “Setting the Replication Slave Configuration”.