What config file is MySQL using?

from the Artful MySQL Tips List


Linux

Mysqld reads my.cnf files found in this order ...
/etc/my.cnf
/etc/mysql/my.cnf
$MYSQL_HOME/my.cnf
[datadir]/my.cnf
~/.my.cnf
A defaults-file server cmd option overrides all those. This ...
mysqld --help --verbose 
... will tell you where mysqld is looking, and ...
locate my.cnf
... will show all existing my.cnf files, and ...
ps aux | grep mysqld
...may show the defaults-file argument.

Note your my.cnf may start with something like ...

# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

Windows

Open the services applet (eg Start | Run | services.msc), scroll down to the MySQL service, click on Properties, and check the value of the --defaults-file option.

Last updated 26 Apr 2024


Return to the Artful MySQL Tips page