MySQL configuration file (my.cnf) file location depends on operating system or installation method. There is no command available to trace the exact file location on your system. In this tutorial I am giving you some default location’s where my.cnf file can be found.
Moreover if my.cnf file is available on more than one location, system load each file and override configuration values.
/etc/my.cnf /etc/mysql/my.cnf $MYSQL_HOME/my.cnf [DATADIR]/my.cnf ~/.my.cnf