Does anyone know if there is a way to confirm if any my.cnf file is being read by MySQL?

I only have the one my.cnf on the machine (and there are no my.ini files) which I have in /etc/my.cnf.

When I run ./mysqld --help --versbose, it doesn't give me the variable I have set in the file, so my assumption was it wasn't loading it or that it was loading a different file.

I tested this by setting my.cnf to 777 and running the command again, this time I get a warning saying the file won't be loaded because it is world writeable.

Is this enough to imply the my.cnf has been loaded and perhaps there is an error in it, causing the variables not to be set or is there some other way of knowing for sure what (if any) my.cnf file is loaded?

  • 1
    Why are you wondering if it is reading your my.cnf file. If you put a error on the my.cnf file on purpose it should show and error when you restart mysql Jan 19, 2011 at 14:44
  • So it does, I was able to use that to track down my problem, cheers!
    – Toby
    Jan 19, 2011 at 14:59
  • Related: MySQL my.cnf location on OS X?
    – kenorb
    Sep 21, 2017 at 18:14

3 Answers 3


If there's only one my.cnf file, and it's /etc/my.cnf, then that's the one it loads. From the manual:

On Unix, Linux and Mac OS X, MySQL programs read startup options from the following files, in the specified order (top items are used first).

/etc/my.cnf Global options

SYSCONFDIR/my.cnf Global options

$MYSQL_HOME/my.cnf Server-specific options

defaults-extra-file The file specified with --defaults-extra-file=path, if any

~/.my.cnf User-specific options (in your home directory)

So, if you check the other directories and there are no my.cnf files, you can be certain it's loading from /etc/my.cnf.

If you use MYSQLAdministrator, supposedly you can get it from Service Control->Configuration File->Config filename, as per this post.


This is a bit crude but I just got for the process line

ps aux | grep mysql

in the output, the mysql process line will come up and should include the --defaults-file being loaded


Connect to your server and run the query SHOW VARIABLES to verify that the settings you put in your my.cnf file are the ones the server is operating with.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.