首先查询mysql安装路径
$ which mysql
显示mysql安装路径如下
/usr/bin/mysql
然后输入如下语句查询默认配置文件加载路径
$ /usr/local/mysql/bin/mysql --verbose --help | grep -A 1 'Default options'
显示如下默认配置文件加载路径信息
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf