5

I would like to know, if possible, how to display (using the command line) the path to my.ini used by the server.

I am using MySQL 5.6 inside a windows IIS.

I have the following:

  • Program Files\MySQL\MySQL Server 5.6\my-default.ini
  • C:\ProgramData\MySQL\MySQL Server 5.6\my.ini.

For sure, the server is using the second one. Is the path stored in any variable inside mysql server variables? I was checking some system variables but I couldn't find it.

Any ideas?


UPDATE After Ronaldo's post I ran a --help and this is what I found:

...
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.6\my.ini 
C:\Program Files\MySQL\MySQL Server 5.6\my.cnf

The following groups are read: mysql client
The following options may be given as the first argument:
--print-defaults        Print the program argument list and exit.
...

The strange thing is that I don't have none of these files. I sit to display hided files on each folder.

So, I took a look to this post and I followed the steps. Finally I arrived at the window MySQL56 Properties(Local Computer). I could read:

Path to executable: 
"C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld.exe" --defaults-file

BUT, if we click over it with the mouse's right button and choose Select All, this is what we have:

"C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld.exe" 
--defaults-file="C:\ProgramData\MySQL\MySQL Server 5.6\my.ini" MySQL56

So that replies my question.

3
  • 1
    locate your service and see properties it would display which file is the default one being used by the service. Moreover you may have to look for process details to to check at command line of windows. On linux you may use ps aux|grep mysql to see and on windows use the above method. Hope it helps – Nawaz Sohail Mar 29 '16 at 13:48
  • 1
    You can specify --defaults-file=<path_to_file> to make absolutely sure that you're using a given file - I issued the command "show variables like '%file%';" and got nothing - I also searched for variables like "cnf" (Linux) - again, no joy. The my-default.ini is AIUI, a file that is copied to the operational location on install - it's up to you then to modify the defaults as per your system and I'm 99% certain that it's never read on server startup. – Vérace Mar 29 '16 at 14:30
  • HI Nawaz, this is what i did. That is why I told I am sure the system is using the second file. But I am not sure. – zwitterion Mar 29 '16 at 18:02
7

mysqld.exe does not report the location of the my.ini it is using. I learned over the years that the my.ini file is supposed to be in the parent folder of the data and bin directories:

What can you do form the command line ?

From the command line, run this

C:\> mysqld --help --verbose > C:\mysqld_options.txt
notepad C:\mysqld_options.txt

Go look for the line that says

Default options are read from the following files in the given order:

The line underneath will tell you the places where mysqld looks for my.ini

If you don't see one, then use the parent folder of the data and bin directory to make one.

Give it a Try !!!

2
  • Please Check an Update. – zwitterion Mar 29 '16 at 18:03
  • 1
    I have my.ini inside C:\ProgramData\MySQL\MySQL Server 5.6`, not inside Program Files\MySQL\MySQL Server 5.6` where bin is located. – zwitterion Mar 29 '16 at 18:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.