tags:

views:

25

answers:

2

Hi All,

I'm trying to determine which my.cnf mysql is using. Is there a command or something for mysql or mysqladmin that shows which one is being loaded?

A: 

the command

SHOW VARIABLES

Will give you a list of variables the current instance of mysql uses.

In the version of mysql I am currently running there is no trace of a my.cnf variable though, so thats not much help

You can always set one of the variables to a different value in each of your my.cnf's, restart the server and use the above command to figure out which configuration it loaded.

Hendrik
+1  A: 

On my linux servers in the startup script (/etc/init.d/mysql) it defines

CONF=/etc/mysql/my.cnf

that it uses to start mysql daemon

EDIT:

also running

mysqld --verbose --help

shows the following info:

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

So if run as a daemon through init script it will look into /etc/myql/my.cnf and if started from the command line it will look there only on the second attempt.

Unreason