content_image/663584.jpg content_image/663585.jpg content_image/663580.jpg content_image/663579.jpg
The MySQL server generates a true UUID in addition to the default or user-supplied server ID set in the server_id  system variable. This is available as the global, read-only variable server_uuid . 

<img src='content_image/663584.jpg'>

## Note 

The presence of the server_uuid  system variable does not change the requirement for setting a unique server_id  value for each MySQL server as part of preparing and running MySQL replication, as described earlier in this section. 

<img src='content_image/663585.jpg'>

When starting, the MySQL server automatically obtains a UUID as follows: 

1.  Attempt to read and use the UUID written in the file data_dir /auto.cnf  (where data_dir  is the server’s data directory). 

2. If data_dir /auto.cnf  is not found, generate a new UUID and save it to this file, creating the file if necessary. 

The auto.cnf  file has a format similar to that used for my.cnf  or my.ini  files. auto.cnf  has 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] server_uuid=8a94f357-aab4-11df-86ab-c80aa9429562 

<img src='content_image/663580.jpg'>

## Important 

The auto.cnf  file is automatically generated; do not attempt to write or modify this file. 

When using MySQL replication, sources and replicas know each other’s UUIDs. The value of a replica’s UUID can be seen in the output of SHOW REPLICAS | SHOW SLAVE HOSTS . Once START REPLICA | SLAVE  has been executed, the value of the source’s UUID is available on the replica in the output of SHOW REPLICA | SLAVE STATUS . 

<img src='content_image/663579.jpg'>

## Note 

Issuing a STOP REPLICA | SLAVE  or RESET REPLICA | SLAVE  statement does not  reset the source’s UUID as used on the replica. 

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 replication I/O thread generates an error and aborts if its source’s UUID is equal to its own unless the --replicate-same-server-id  option has been set. In addition, the replication I/O thread generates a warning if either of the following is true: 

•No source having the expected server_uuid  exists. 

•The source’s server_uuid  has changed, although no CHANGE REPLICATION SOURCE TO  | CHANGE MASTER TO  statement has ever been executed. 

