How do I know which configuration file is used by MySQL currently? Is there any command or something to find it out?
The information you want can be found by running
mysqld --help --verbose
I tried this command on my machine:
mysql --help | grep Default -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.