Pre-General Availability Draft: 2017-09-22
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 and global transaction identifiers (GTIDs). A set of quick-reference tables providing basic information about these options and variables is also included.
Of particular importance is the
|Permitted Values (<= 8.0.2)||Type||integer|
|Permitted Values (>= 8.0.3)||Type||integer|
This option specifies a server ID, which is required for binary
logging. From MySQL 8.0.3, binary logging is enabled by default, so
server_id system variable is set to 1 by
default (previously, it was set to 0). The server can be started
with this default ID, but a warning message is issued if you did not
specify a server ID explicitly.
For master and slave replication servers, you must specify a unique server ID for each replication server, 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 126.96.36.199, “Replication Master Options and Variables”, and Section 188.8.131.52, “Replication Slave Options and Variables”.
If you specify
--server-id without an
argument, the effect is the same as specifying a value of 0. If the
server ID is 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.
For more information, see Section 184.108.40.206, “Setting the Replication Slave Configuration”.
The MySQL server generates a true UUID in addition to the default or
user-supplied server ID set in the
system variable. This is available as the global, read-only variable
The presence of the
system variable does not change the requirement for setting a
--server-id for each MySQL
server as part of preparing and running MySQL replication, as
described earlier in this section.
When starting, the MySQL server automatically obtains a UUID as follows:
auto.cnf file has a format similar to that
files. In MySQL 8.0,
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.
When using MySQL replication, masters and slaves know each
other'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, the
value of the master's UUID is available on the slave in the
SHOW SLAVE STATUS.
server_uuid is also used in GTIDs
for transactions originating on that server. For more information,
see Section 18.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: