Bug #71419 mysql is ignoring !include path
Submitted: 19 Jan 2014 16:39 Modified: 2 Oct 2019 14:19
Reporter: Carsten Wiedmann Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Options Severity:S3 (Non-critical)
Version:5.6.15 OS:Windows
Assigned to: CPU Architecture:Any

[19 Jan 2014 16:39] Carsten Wiedmann
Description:
MySQL is installed in "C:\Program Files\MySQL\MySQL Server". In this directory I have a "my.ini" with only:
| !include "C:/ProgramData/MySQL/MySQL Server/my.ini"

In "C:\ProgramData\MySQL\MySQL Server" I have a "my.ini" starting with:
| [client]
| port = 3306
| default-character-set = utf8
| 
| [mysqld]
| ...

But "mysql" does not read the included "my.ini" (e.g. charset is not change to utf8). It's working with "mysqld". The server is reading the "[mysqld]" section from the included file.

If I change the first "my.ini" (removing the quotation marks) to:
| !include C:/ProgramData/MySQL/MySQL Server/my.ini

It's working with the client. Of course, according to the manual [1], I have to use:
| !include "C:/ProgramData/MySQL/MySQL Server/my.ini"
or
| !include C:/ProgramData/MySQL/MySQL\sServer/my.ini

--> Quote the complete path, or escape the space in "MySQL Server".

[1] http://dev.mysql.com/doc/refman/5.6/en/option-files.html

 

How to repeat:
see description
[19 Jan 2014 17:07] Carsten Wiedmann
OK, "mysqld" is reading the correct file because of a "-defaults-file" in the service command line. So we have the same error with server and client.

BTW:
| !include C:/ProgramData/MySQL/MySQL\sServer/my.ini

is also not working.
[13 Oct 2014 14:41] MySQL Verification Team
Thank you for the bug report.
[2 Oct 2019 14:19] Paul DuBois
Posted by developer:
 
Added information about this issue at the end of
https://dev.mysql.com/doc/refman/8.0/en/option-files.html#option-file-inclusions:

For inclusion directives to work, the file path should not be specified within quotes and should have no escape sequences. For example, the following statements provided in my.ini will read the option file myopts.ini:

!include C:/ProgramData/MySQL/MySQL Server/myopts.ini
!include C:\ProgramData\MySQL\MySQL Server\myopts.ini
!include C:\\ProgramData\\MySQL\\MySQL Server\\myopts.ini

On Windows, if !include /path/to/extra.ini is the last line in the file, make sure that a newline is appended at the end or the line will be ignored.