WL#2027: Make client tools work for any basedir value

Affects: Server-4.1   —   Status: Un-Assigned   —   Priority: Medium

MySQL will provide a means to ensure that client tools work 
correctly even if mysql has not been installed or symlinked 
to the directory /usr/local/mysql 
 
Rationale: 
Enterprise customers need to be able to install mysql into 
esoteric directory structures and have client tools (mysqldump, 
mysqlaccess, and safe_mysqld in particular) still work without 
a symlink to /usr/local/mysql (which is standard for linux, 
but against corporate standards). 
 
Means: 
MySQL client programs will examine the environment variable 
MYSQL_HOME, according to the guidelines in WL#2336 
Environment variables as in Oracle. 
Many of the client tools do not work unless you have installed or symlinked 
mysql to the directory /usr/local/mysql - see bug report 4659 for a partial 
list 
and description and some good comments.  
 
Enterprise customers need to be able to install mysql into esoteric directory 
structures and have client tools (mysqldump, mysqlaccess, and safe_mysqld in 
particular) still work without a symlink to /usr/local/mysql (which is standard 
for linux, but against corporate standards). This can be accomplished in one of 
two ways: 
 
1) have all clients respond to a --basedir=switch that defines the basedir for 
that tool. note that some scripts (e.g. mysql.server init.d script) will claim 
to do this but in reality are looking to confirm this value with the output of 
my_print_defaults, which it only looks for in /usr/local/mysql/bin/ or the 
current directory. 
This suggestion won't be used. 
 
2) Have all clients respond to a MYSQLHOME directory similar to ORAHOME in 
Oracle - an environment variable that points to the base dir. Monty indicated 
to 
me that the server used to have such a variable in earlier versions, so it 
might 
be what he would prefer. This is the preferred solution, but either is  
acceptable. 
This suggestion will be used. 
The environment variable will be MYSQL_HOME, similar to ORACLE_HOME, 
according to the guidelines in WL#2336, and in conjunction with 
other environment variables, such as MYSQL_BASE, also described in WL#2336.