Bug #70443 mysql client program ignores my.ini settings
Submitted: 26 Sep 2013 19:29 Modified: 15 Mar 2016 18:39
Reporter: Peter Brawley (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:5.7.2 OS:Microsoft Windows (win 7 64-bit)
Assigned to: CPU Architecture:Any
Triage: Needs Triage: D2 (Serious)

[26 Sep 2013 19:29] Peter Brawley
Description:
Whether started standalone or as a service, the 5.7.2 mysql client program ignores  my.ini settings under [mysql]

How to repeat:
In C:\ProgramData\MySQL\MySQL Server 5.7\my.ini write ...

[mysql]
prompt=\h.\d\n
default-character-set=utf8

Define and start the service as ...

"C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld" --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.7\my.ini" MySQL57

Run mysql. The prompt is the default prompt.
[26 Sep 2013 19:39] Shane Bester
Can you please run:

mysql.exe --help

and look what is says under "Default options are read from the following files in the given order:"
[26 Sep 2013 19:46] Peter Brawley
So the bug is actually that the MySQL Windows 7 Installer writes my.ini to a folder which the mysql client does not look at.

Well that's much better.

Not.
[26 Sep 2013 23:31] Miguel Solorzano
Thank you for the bug report. Indeed the my.ini file is located where the clients programs don't look for.
[27 Sep 2013 8:01] Peter Laursen
Documentation says:
http://dev.mysql.com/doc/refman/5.7/en/option-files.html

"On Windows, MySQL programs read startup options from the following files, in the specified order (top items are used first). File Name	Purpose
%PROGRAMDATA%\MySQL\MySQL Server 5.7\my.ini, %PROGRAMDATA%\MySQL\MySQL Server 5.7\my.cnf	Global options
%WINDIR%\my.ini, %WINDIR%\my.cnf	Global options
C:\my.ini, C:\my.cnf	Global options
INSTALLDIR\my.ini, INSTALLDIR\my.cnf	Global options
defaults-extra-file	The file specified with --defaults-extra-file=path, if any
%APPDATA%\MySQL\.mylogin.cnf	Login path options

%PROGRAMDATA% represents the file system directory that contains application data for all users on the host. This path defaults to C:\ProgramData on Microsoft Windows Vista and greater, and C:\Documents and Settings\All Users\Application Data on older versions of Microsoft Windows."

.. so the client does not behave as documented I guess?
[27 Sep 2013 8:10] Peter Laursen
My guess is that documentation is wrong!  This paragraph in docs was edited recently. And I guess just to reflect what "MySQL Installer" does.  I doubt that binaries (server and clients) had any such change internally. But maybe I am wrong?

The server (installed with "MySQL Installer" will look for the my.ini correctly as the registry key defining the service has a --defaults-file specification pointing to my.ini.  But the command line clients don't read this registry key.
[15 Mar 2016 18:39] Javier TreviƱo
Posted by developer:
 
Confirmed this is working on the latest version of the MySQL Installer for Windows (1.4.15).
This bug is too old and it was most likely fixed in the transition from 1.3.x to 1.4.0.
Tested with the steps to duplicate and confirmed the prompt changes correctly in the MySQL client.