mysql配置文件读取顺序

来源:互联网 发布:春天奏鸣曲 贝多芬知乎 编辑:程序博客网 时间:2024/06/06 07:20

On Unix, Linux and Mac OS X, MySQL programs read startup options from the following files, in the specified order (top items are used first).

File NamePurpose/etc/my.cnfGlobal options/etc/mysql/my.cnfGlobal optionsSYSCONFDIR/my.cnfGlobal options$MYSQL_HOME/my.cnfServer-specific optionsdefaults-extra-fileThe file specified with --defaults-extra-file=path, if any~/.my.cnfUser-specific options读取顺序为:
/etc/my.cnf
basedir/my.cnf
datadir/my.cnf
--defaults-extra-file    #在读取全局配置文件之后,读取用户配置文件(~/.my.cnf)之前,读取extra指定的参数文件
~/.my.cnf      #家目录下面的隐藏文件,my.cnf前面的点,说明my.cnf是隐藏文件   
假设4个配置文件都存在,同时使用--defaults-extra-file指定了参数文件,如果这时有一个 "参数变量"在5个配置文件中都出现了,那么后面的配置文件中的参数变量值 会 覆盖 前面配置文件中的参数变量值,就是说会使用~/.my.cnf中设置的值。

*****注意*****
   如果使用./bin/mysqld_safe 守护进程启动mysql数据库时,使用了 --defaults-file=<配置文件的绝对路径>参数,这时只会使用这个参数指定的配置文件。

转自:http://blog.csdn.net/jscpb/article/details/7184133
0 0
原创粉丝点击