Bug #25085 mysqld_safe causes mysqld to read my.cnf twice
Submitted: 15 Dec 2006 2:25 Modified: 4 Dec 2007 19:52
Reporter: Kolbe Kegel Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.30 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: bfsm_2007_06_21

[15 Dec 2006 2:25] Kolbe Kegel
Description:
Under certain conditions, mysqld_safe will create a set of circumstances that causes mysqld to read the my.cnf file twice.

This causes confusion when replicate-* rules are doubled in SHOW SLAVE STATUS output, for instance, and may caus other unforeseen problems.

The conditions that cause this are as follow:

1. my.cnf file is in the data directory
2. the data directory is in a predictable location (./data relative to $PWD when you run mysqld_safe)

How to repeat:
1. Create this my.cnf file in the "data" subdirectory of a standard MySQL TGZ release:

[mysqld]
log-bin
binlog-do-db=db1

2. Start the MySQL server like this:

./bin/mysqld_safe

3. Issue SHOW MASTER STATUS against the server:

mysql 5.0.30-enterprise-gpl-log (root) [test]> show master status;
+-------------------+----------+--------------+------------------+
| File              | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+-------------------+----------+--------------+------------------+
| beluga-bin.000001 |       98 | db1,db1      |                  | 
+-------------------+----------+--------------+------------------+
1 row in set (0.00
 sec)

The repetition of "db1" in the "Binlog_Do_DB" column shows that the server has read the my.cnf file twice.

It reads it once because mysqld_safe sets --defaults-extra-file=$DATADIR/my.cnf and it reads it a second time because mysqld_safe sets MYSQL_HOME=$DATADIR

Suggested fix:
mysqld_safe should not set both defaults-extra-file and MYSQL_HOME in this situation
[4 Dec 2007 19:52] Konstantin Osipov
Duplicate of Bug#20748.