_WhereIsMySQLConfiguration

_InclusionsLibrary

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community

Where is the MySQL Configuration file located?

The location of the MySQL configuration file (either my.cnf or my.ini depends on your operating system). MySQL will look at each location in order, and use the first file that it comes across. Often, if the file does not exist, it must be created first.

INSTALLDIR refers to the location that MySQL was installed to.

Linux based systems

Click here to expand...

Linux based MySQL systems will use configuration files in the following order of precedence

  • /etc/my.cnf
  • /etc/mysql/my.cnf
  • SYSCONFDIR/my.cnf
  • $MYSQL_HOME/my.cnf

SYSCONFDIR refers to the directory specified when MySQL was built; and typically reverse to the etc directory located under the compiled-in installation directory.

MYSQL_HOME is an environment variable referring to the path where my.cnf can be found.

Regarding MySQL Safe Mode

When MySQL is started using mysqld_safe, MySQL will automatically set MYSQL_HOME if no such variable exists already. If a my.cnf file exists in the data directory (typically /usr/local/mysql/data), then that file will be used. Otherwise, the installation directory will be used (typically /usr/local/var). See the MySQL Documentation for more information on how to configure option files.

Windows based systems

Click here to expand...

Windows based MySQL systems will use the configuration files in the following order of precedence

  • %PROGRAMDATA%\MySQL\<MySQL Server Version>\my.ini
  • %PROGRAMDATA%\MySQL\<MySQL Server Version>\my.cnf
  • %WINDIR%\my.ini
  • %WINDIR%\my.cnf
  • C:\my.ini
  • C:\my.cnf
  • INSTALLDIR\my.ini
  • INSTALLDIR\my.cnf
Last modified on Jul 28, 2015

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.