How to find the mySQL configuration file "my.cnf".

Document ID : KB000015656
Last Modified Date : 14/02/2018
Show Technical Document Details
Introduction:

The mySql file can be found in multiple default locations and under various names. e.g.

etc/my.cnf,

/etc/mysql/my.cnf,

/usr/etc/my.cnf,

C:\Windows\my.ini,

C:\Windows\my.cnf,

C:\my.ini, C:\my.cnf,

C:\Program Files\MySQL\MySQL Server 5.5\my.ini C:\Program Files\MySQL\MySQL Server 5.5\my.cnf.

Question:

How can I find the mySql configuration file?

Answer:

You can actually ask MySQL to show you the list of all locations where it searches for my.cnf (or my.ini on Windows). It is not an SQL command though. Rather, execute: 

$ mysqld --help --verbose 

 

In the very first lines you will find a message with a list of all my.cnf locations it looks for. On my machine it is: 

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

/etc/my.cnf 

/etc/mysql/my.cnf 

/usr/etc/my.cnf 

~/.my.cnf 

 

Or, on Windows: 

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

Additional Information:

How to find the mySQL configuration file "my.cnf".

https://stackoverflow.com/questions/2482234/how-to-know-mysql-my-cnf-location