Mysql – Confirm that the.cnf file has loaded OK

my.cnfMySQL

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?

Best Answer

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.