Mysql之 配置文件读取顺序

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 Name Purpose
/etc/my.cnf Global options
/etc/mysql/my.cnf Global options
SYSCONFDIR/my.cnf Global options
$MYSQL_HOME/my.cnf Server-specific options
defaults-extra-file The file specified with --defaults-extra-file=path, if any
~/.my.cnf User-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=<配置文件的绝对路径>参数,这时只会使用这个参数指定的配置文件。
 

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 Name Purpose
/etc/my.cnf Global options
/etc/mysql/my.cnf Global options
SYSCONFDIR/my.cnf Global options
$MYSQL_HOME/my.cnf Server-specific options
defaults-extra-file The file specified with --defaults-extra-file=path, if any
~/.my.cnf User-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=<配置文件的绝对路径>参数,这时只会使用这个参数指定的配置文件。

猜你喜欢

转载自www.cnblogs.com/EikiXu/p/9835300.html