How to find out the location of currently used MySQL configuration file in linux

If you are using terminal just type the following:

locate my.cnf

mysqld --help --verbose will find only location of default configuration file. What if you use 2 MySQL instances on the same server? It's not going to help.

Good article about figuring it out:

"How to find MySQL configuration file?"


The information you want can be found by running

mysql --help

or

mysqld --help --verbose

I tried this command on my machine:

mysql --help | grep "Default options" -A 1

And it printed out:

Default options are read from the following files in the given order:
/etc/my.cnf /usr/local/etc/my.cnf ~/.my.cnf

See if that works for you.

Tags:

Linux

Mysql