Find the mySQL configuration file "my.cnf"
search cancel

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 you find the mySql configuration file?

Environment

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

Resolution

You can 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. 

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