mysql 同一个选项配置两次时如何解决冲突?
How does mysql resolves conflict when same option is configured twice?
/etc/mysql/my.cnf
[mysqld]
option_1=val_1
!includedir /etc/mysql/conf.d/
/etc/mysql/conf.d/test.cnf
[mysqld]
option_1=val_2
如您所见,同一个选项在本例中 option_1 被定义了两次。一次在主配置文件中,其他时间在包含文件中。
我的问题是 mysql 将什么作为 option_1 的最终值?
- val_1
- val_2
https://dev.mysql.com/doc/refman/5.7/en/option-files.html 部分表示:
If multiple instances of a given option are found, the last instance takes precedence, with one exception: For mysqld, the first instance of the --user option is used as a security precaution, to prevent a user specified in an option file from being overridden on the command line.
(强调我的)
在您的示例中,该选项将设置为 val_2
。
/etc/mysql/my.cnf
[mysqld]
option_1=val_1
!includedir /etc/mysql/conf.d/
/etc/mysql/conf.d/test.cnf
[mysqld]
option_1=val_2
如您所见,同一个选项在本例中 option_1 被定义了两次。一次在主配置文件中,其他时间在包含文件中。 我的问题是 mysql 将什么作为 option_1 的最终值?
- val_1
- val_2
https://dev.mysql.com/doc/refman/5.7/en/option-files.html 部分表示:
If multiple instances of a given option are found, the last instance takes precedence, with one exception: For mysqld, the first instance of the --user option is used as a security precaution, to prevent a user specified in an option file from being overridden on the command line.
(强调我的)
在您的示例中,该选项将设置为 val_2
。