Bug #7518 mysqld_safe detects mysqld erroneously if data dir is moved
Submitted: 23 Dec 2004 23:18 Modified: 24 Dec 2004 8:38
Reporter: Lachlan Mulcahy Email Updates:
Status: Duplicate Impact on me:
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.x OS:Linux (Linux)
Assigned to: Assigned Account

[23 Dec 2004 23:18] Lachlan Mulcahy
If mysqld_safe cannot find a valid datadir at $MYSQLDIR/data or $MYSQLDIR/var it may execute 
an incorrect binary even when basedir is passed either directly or within a my.cnf from a --
defaults-file parameter.

How to repeat:
Install a 4.0 tree of mysql into /usr/local/mysql
Do a mysql_install_db.
Install a 4.1 tree of mysql into /usr/local/mysql41
Do a mysql_install_db on the 4.1 tree.
Move the data dir of the 4.1 tree to /var/data
Create a my.cnf within /usr/local/mysql41 with appropriate socket, pid, basedir, etc.
Ensure this my.cnf has datadir set to /var/data
cd /usr/local/mysql41
./bin/mysqld_safe --defaults-file=my.cnf
./bin/mysqld_safe --basedir=/usr/local/mysql41 --datadir=/var/data 

The 4.0 binary is executed in both cases; user would not expect this.

Suggested fix:
Update mysqld_safe script to detect this case better or document clearly how a user should 
implement this kind of situation; creating a symlink of 'data' to a valid datadir is a workaround, 
but is kludgy.
[24 Dec 2004 8:38] Sergei Golubchik
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments
to the original bug instead.

Thank you for your interest in MySQL.

Additional info:

Looks like a duplicate of http://bugs.mysql.com/?id=7249