Bug #106568 Default optionsfile my.cnf order
Submitted: 25 Feb 2022 3:52 Modified: 27 Feb 2022 12:20
Reporter: bin wang (OCA) Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: MySQL Verification Team CPU Architecture:Any

[25 Feb 2022 3:52] bin wang
Description:
mysqldump  Ver 8.0.28 for Linux on x86_64 (Source distribution)
............................
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /etc/mysql8/my.cnf ~/.my.cnf 
...........................
but in mysql-server/mysys/my_default.cc is 

"
1406     default_paths["/etc/my.cnf"] = enum_variable_source::GLOBAL;
         default_paths["/etc/mysql/my.cnf"] = enum_variable_source::GLOBAL;
     default_paths[string(buffer) + ".my.cnf"] = enum_variable_source::MYSQL_USER;
"

How to repeat:

file order is /etc/my.cnf /etc/mysql/my.cnf /etc/mysql8/my.cnf ~/.my.cnf 
but from code file order  is /etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf/etc/mysql8/my.cnf 
I  think  put  " defsyscondir + "/my.cnf" " before "string(buffer) + ".my.cnf" " will be better. 

Suggested fix:
mysql-server/mysys/my_default.cc 

"
1406 default_paths["/etc/my.cnf"] = enum_variable_source::GLOBAL;
     default_paths["/etc/mysql/my.cnf"] = enum_variable_source::GLOBAL;
++ #if defined(DEFAULT_SYSCONFDIR)
++   default_paths[defsyscondir + "/my.cnf"] = enum_variable_source::GLOBAL;
++ #endif
  default_paths[string(buffer) + ".my.cnf"] = enum_variable_source::MYSQL_USER;
  default_paths[string(buffer) + ".mylogin.cnf"] = enum_variable_source::LOGIN;

-- #if defined(DEFAULT_SYSCONFDIR)
--   default_paths[defsyscondir + "/my.cnf"] = enum_variable_source::GLOBAL;
-- #endif
[25 Feb 2022 14:51] MySQL Verification Team
Hi Mr. wang,

Thank you for your bug report.

However, it is not a bug.

Simply, default locations for the configuration file(s) differ between server and client-side programs. The example of client programs is our mysqldump.

Hence, it is not a bug.
[27 Feb 2022 12:20] bin wang
thank you for your reply ,
this bug is in mysqldump ? 
May I changge the Category in mysqldump ?