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.

RolandoMySQLDBA
  • 185,223
  • 33
  • 326
  • 536
IgorAlves
  • 337
  • 3
  • 5
  • 16

1 Answers1

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 !!!

RolandoMySQLDBA
  • 185,223
  • 33
  • 326
  • 536