简介:MySQL启动时,会自动从data_dir/auto.cnf 文件中获取server-uuid值,并将这个值存储在全局变量server_uuid中。如果这个值或者这个文件不存在,那么将会生成一个新的uuid值,并将这个值保存在auto.cnf文件中。
源码解释:
/**
File 'auto.cnf' resides in the data directory to hold values of options that
server evaluates itself and that needs to be durable to sustain the server
restart. There is only a section ['auto'] in the file. All these options are
in the section. Only one option exists now, it is server_uuid.
Note, the user may not supply any literal value to these auto-options, and
only allowed to trigger (re)evaluation.
For instance, 'server_uuid' value will be evaluated and stored if there is
no corresponding line in the file.
Because of the specifics of the auto-options, they need a seperate storage.
Meanwhile, it