MySQL技术内幕InnoDB存储引擎 - 查找配置文件顺序

以下命令可以查看当 MySQL 数据库实例启动时,会在哪些位置查找配置文件:
linux:
[root@hpj-dna-test ~]# /usr/bin/mysql --help | grep my.cnf
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

 

windows:
mysql --help

在结果中我们可以找到如下信息:
Default options are read from the following files in the given order:
C:\windows\my.ini
C:\windows\my.cnf
C:\my.ini
C:\my.cnf
E:\Developer\DBServer\Mysql\mysql-5.6.24\my.ini E:\Developer\DBServer\Mysql\mysql-5.6.24\my.cnf

 

MySQL 数据库是按从上往下的顺序读取配文件的。
同一个参数MySQL会以读取到的最后一个配置文件中的参数为准。
 

posted on 2020-01-05 10:34  HB1  阅读(111)  评论(0)    收藏  举报

导航