2010年5月18日 星期二

MySQL開機時讀取my.cnf的順序

我在以下兩個地方都有my.cnf檔

/usr/local/etc/my.cnf
/var/db/mysql/my.cnf

在啟動MySQL時,出現

100518 18:12:02 mysqld_safe WARNING: Found two instances of my.cnf -
/usr/local/etc/my.cnf and
/var/db/mysql/my.cnf
IGNORING /var/db/mysql/my.cnf
100518 18:12:02 mysqld_safe Logging to '/var/db/mysql/test.localhost.com.tw.err'.
100518 18:12:02 mysqld_safe Starting mysqld daemon with databases from /var/db/mysql

由此可知讀my.cnf的順序為
1. /usr/local/etc 
2. /var/db/mysql


在ssh下
/usr/local/bin/mysql --verbose --help

會出現下面讀my.cnf的順序

Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/etc/my.cnf /usr/local/etc/mysql/my.cnf

沒有留言: