1.通过which mysql命令来查看mysql的安装位置。
假定确定mysql位于/usr/local/mysql/bin目录
2.查看配置信息
执行如下命令:/usr/local/mysql/bin/mysqld --verbose --help |grep -A 1 'Default options'
可能看到如下信息:
2019-04-14 19:18:23 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled
2019-04-14 19:18:23 0 [Note] mysqld (mysqld 5.6.42) starting as process 14944 ...
2019-04-14 19:18:23 14944 [Note] Plugin 'FEDERATED' is disabled.
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
2019-04-14 19:18:23 14944 [Note] Binlog end
2019-04-14 19:18:23 14944 [Note] Shutting down plugin 'MyISAM'
2019-04-14 19:18:23 14944 [Note] Shutting down plugin 'CSV'
3.结果
上面信息中,etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf给出的几个目录,就是mysql依次查找配置文件的位置。
网友评论