Bug #575 Alternate mysql data directory does not work w/o (more) modifications
Submitted: 3 Jun 2003 8:55 Modified: 30 Jun 2003 5:15
Reporter: [ name withheld ] Email Updates:
Status: Can't repeat Impact on me:
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:4.0.12,13 OS:Linux (debian)
Assigned to: Lenz Grimmer CPU Architecture:Any

[3 Jun 2003 8:55] [ name withheld ]
When installing the binary distribution and then putting the data directory in a place other than /usr/local/mysql (why have it there by default? When you upgrade distributions and the /usr/local/mysql symlink, you'll lose all the data.), the mysqld_safe script behaves erroneously. 

How to repeat:
Install binary distribution per install instructions.

Make an alternate data directory for all data.

Modify mysql.server startup script to set alternate directory:
> # Set some defaults
> datadir=xxxxxx

Start server with  command:
 /etc/init.d/mysql.server start 

Receive the following error: 

The file /usr/local/mysql/libexec/mysqld doesn't exist or is not executable
Please do a cd to the mysql installation directory and restart
this script from there as follows:


However, symlink /usr/local/mysql/data to the real data directory, and everything is fine.

Suggested fix:
startup and mysqld_safe scripts (entire startup process)  buggy and old and convoluted and have been for a long time.  rewrite.
[3 Jun 2003 8:57] [ name withheld ]
Example: "The file /usr/local/mysql/libexec/mysqld doesn't exist"

Why is script looking at libexec subdirectory?  That hasnt existed in the binary distribution in awhile.  As far as I can remember the daemon lived at MYSQLDIR/bin/mysqld
[30 Jun 2003 5:15] Lenz Grimmer
Sorry, I was not able to reproduce the problem you reported.
I moved /usr/local/mysql/data into another location, updated "datadir"
in mysql.server accordingly and MySQL started up fine without having to
create a symbolic link. Can you please give me a more detailed description
on how to reproduce your error? Or could you please run 

sh -x /etc/init.d/mysql.server start

to generate some more verbose output of what the script is doing in your case?

Some additional comments to your report:

Why do you think that you would lose all your data when updating?
The binary distributions are named "mysql-version", thus they do never install
in the same directory as the previous installation. Also, as our distribution
files do not include anything in the data directory, there is nothing than
can be overwritten.

About your other comments about these scripts: if you think they are buggy, old and convoluted, we happily accept patches :)