Bug #84840 Option File Under %PROGRAMDATA% Isn't Read
Submitted: 6 Feb 2017 13:50 Modified: 5 Jun 2018 23:39
Reporter: Mikiya Okuno Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.7 OS:Windows
Assigned to: CPU Architecture:Any

[6 Feb 2017 13:50] Mikiya Okuno

On Table 5.1 Option Files Read on Windows Systems, "%PROGRAMDATA%\MySQL\MySQL Server 5.7\my.ini" and "%PROGRAMDATA%\MySQL\MySQL Server 5.7\my.cnf" are listed first. However, these files are not read at all, actually.

How to repeat:
See the list of option files read by the program using --help --verbose

PS C:\Program Files\MySQL\MySQL Server 5.7\bin> (.\mysqld --help --verbose)[20..24]

Default options are read from the following files in the given order:
C:\WINDOWS\my.ini C:\WINDOWS\my.cnf C:\my.ini C:\my.cnf C:\Program Files\MySQL\MySQL Server 5.7\my.ini C:\Program Files\MySQL\MySQL Server 5.7\my.cnf
The following groups are read: mysqld server mysqld-5.7
The following options may be given as the first argument:

Suggested fix:
Remove it from the document, or modify the program so that it reads an option file under "%PROGRAMDATA%\MySQL\MySQL Server 5.7".
[6 Feb 2017 15:57] Peter Laursen
In my understanding Option File Under %PROGRAMDATA% will be read if you install using the "MySQL Installer" as this Installer creates a registry key like ""C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe" --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.7\my.ini" MySQL57" in CurrentControlSet .. Services group of Windows registry. 

.. but if you install otherwise or just start the server from command line %PROGRAMDATA% won't be read for theoptions file.

-- Peter
-- not a MySQL/Oracle person
[6 Feb 2017 16:00] Peter Laursen
On a sideremark, I think I remember other cases (sorry, can't rememeber details) where the server documentaton assumes that the "MySQL Installer" is used for installation. 

.. and it is incorrect to make such assumption in server documentation, IMO.
[27 Nov 2017 13:05] d sech
This is definitely an inconsistency between mysql and documentation. Docs specify the config file is looked first in %PROGRAMDATA%, but this is not true.

It becomes a bit more awkward because Installer actually creates the default my.ini in %PROGRAMDATA%, and configures the mysqld service to load this file, but no other binary will read it (mysql, mysqladmin, ...)

This forces me to create a separate file in one of the valid locations (%WINDIR%, C:\, ...).
And because I don't want to maintain multiple my.ini files, I also need to reinstall the mysqld service to load the new file instead of the one in %PROGRAMDATA%

I would suggest one of these two options:
A. actually make the mysql binaries to look for config file in %PROGRAMDATA%, as specified by docs.


B.1 - Remove the %PROGRAMDATA% from Docs
B.2 - Update mysql Installer to create my.ini in one of the other valid locations, and configure mysqld service to load it from there
[27 Nov 2017 13:15] Peter Laursen
Windows supports symlinks (since Vista as far as I remember). A solution could be to let the installer create a symlink in 'basedir'. Then clients will be redirected.
[5 Jun 2018 23:39] Christine Cole
Posted by developer:
Fixed as suggested in the 5.5, 5.6, 5.7, and 8.0 documentation manuals.

Thank you for the bug report.