The following 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.
Of particular importance is the
server_id system variable.
This variable specifies the server ID.
On a replication master and each replication slave, you
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 22.214.171.124, “Replication Master Options and Variables”, and
Section 126.96.36.199, “Replication Slave Options and Variables”.
If you do not specify
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.6, 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 188.8.131.52, “Setting the Replication Slave Configuration”.
When starting, the MySQL server automatically obtains a UUID as follows:
auto.cnf file has a format similar to that
files. In MySQL 5.6,
only a single
[auto] section containing a single
server_uuid setting and value; the
file's contents appear similar to what is shown here:
auto.cnf file is automatically generated;
do not attempt to write or modify this file.
Also beginning with MySQL 5.6, when using MySQL replication, masters
and slaves know one another's UUIDs. The value of a
slave's UUID can be seen in the output of
SHOW SLAVE HOSTS. Once
START SLAVE has been executed (but
not before), the value of the master's UUID is available on the
slave in the output of
In MySQL 5.6.5 and later, a server's
server_uuid is also used in GTIDs for
transactions originating on that server. For more information, see
Section 17.1.3, “Replication with Global Transaction Identifiers”.
When starting, the slave I/O thread generates an error and aborts if
its master's UUID is equal to its own unless the
--replicate-same-server-id option has
been set. In addition, the slave I/O thread generates a warning if
either of the following is true: