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

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

book

Article ID: 15656

calendar_today

Updated On:

Products

CA Spectrum

Issue/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.



How can I find the mySql configuration file?

Environment

Release: SDBSFO99000-10.2-Spectrum-Device Based Suite-Server FOC
Component:

Resolution

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