1 message in com.mysql.lists.bugsBugs in MySQL server startup script &...
FromSent OnAttachments
Calmbach, Richard18 Nov 2002 15:34 
Subject:Bugs in MySQL server startup script & manual
From:Calmbach, Richard (rich@fairisaac.com)
Date:11/18/2002 03:34:23 PM
List:com.mysql.lists.bugs

There are a few bugs in the "support-files/mysql.server" script and there are
some discrepancies between what the manual says and what the scripts actually
do. The remarks below apply to MySQL 3.23.53a-max (Linux binary distribution
mysql-max-3.23.53a-pc-linux-gnu-i686.tar.gz) and Manual version 4.0.5-beta. The
bugs are platform-independent; they apply to all Unix platforms (wherever
"mysql.server" is used). Some bugs have been fixed in MySQL 4.0.5-beta, but not
all of them; this is indicated below. The line numbers refer to script
"mysql.server" from v3.23.53a-max.

I hope you will find these notes helpful.

-Richard

How-To-Repeat: Item 1 (bug in v3.23.53 and v4.0.5-beta): The MySQL manual at
http://www.mysql.com/documentation/mysql/bychapter/manual_Installing.html#Automatic_start
claims that script "mysql.server" processes the [mysql.server] option group in
configuration files. I believe that this is the intention. However, the script
"mysql.server" actually processes option group [mysql_server]. In
"support-files/mysql.server", line 106: "mysql_server" should be "mysql.server".
Also, the comment on line 68 should be changed accordingly.

Item 2 (bug in v3.23.53, fixed in v4.0.5-beta): support-files/mysql.server, line
48: "@HOSTNAME@" should be "/bin/hostname"

Item 3 (bug in v3.23.53, fixed in v4.0.5-beta, but the remark still applies):
When MySQL is installed into the default location (/usr/local/mysql), there is a
problem with "support-files/mysql.server" when one tries to use it as
/etc/init.d/mysql.server to automatically start the mysqld server at system
startup, when it cannot be guaranteed that the present working directory is
/usr/local/mysql. In "support-files/mysql.server", line 42-45: "bindir" should always be set to
"$basedir/bin", not just in the "else" case. This way, the

if test -x $bindir/my_print_defaults

on line 72 succeeds for the case of the default binary installation location
(/usr/local/mysql) and it is no longer necessary to have an entry for "basedir"
in "/etc/my.cnf" just to help mysql.server find the "my_print_defaults"
executable. Currently, even for an installation into the default location
(/usr/local/mysql), there must be an entry for "basedir" in "/etc/my.cnf",
otherwise "/etc/init.d/mysql.server" will fail to start the mysqld server. This
is somewhat counterintuitive, since the default is generally meant to work
without requiring user intervention and explicit configuration (in this case:
the user editing the "/etc/my.cnf" file and adding the line for "basedir").

An alternative solution would be to change the

if test -x ./bin/my_print_defaults

on line 69 in "mysql.server" to

if test -x $basedir/bin/my_print_defaults

This way, the "my_print_defaults" executable would also be found automatically.

Item 4 (bug in Manual v4.0.5-beta): The MySQL manual section 2.4.3 "Starting and
Stopping MySQL Automatically"
(http://www.mysql.com/documentation/mysql/bychapter/manual_Installing.html#Automatic_start)
should make clear that one should either follow the instructions in mysql.server
(to use "/etc/init.d/mysql.server") OR append the

/bin/sh -c 'cd /usr/local/mysql ; ./bin/safe_mysqld --user=mysql &'

line to /etc/rc.local, but not both.

Item 5.a (bug in Manual v4.0.5-beta): The table at the end of section 2.4.3
"Starting and Stopping MySQL Automatically"
(http://www.mysql.com/documentation/mysql/bychapter/manual_Installing.html#Automatic_start)
claims that script "safe_mysqld" reads option group [mysql.server] from option
files, but actually it doesn't. Instead, it reads option group [safe_mysqld],
which is not mentioned in the table. In fact, since the renaming of
"safe_mysqld" to "mysqld_safe", the script also reads option group
[mysqld_safe].

Item 5.b (bug in Manual v4.0.5-beta): The table also claims that the
"mysql.server" script reads the "server" option group, but actually it doesn't.
Maybe it is supposed to, in which case this would be a bug in the "mysql.server"
script.

Item 6 (bug in Manual v4.0.5-beta): At the top of section 2.4 "Post-installation
Setup and Testing"
(http://www.mysql.com/documentation/mysql/bychapter/manual_Installing.html#Post-installation),
it says that for a binary distribution (not RPM or pkg packages), one should use
"./bin/mysql_install_db". This should read "./scripts/mysql_install_db".

Item 7 (bug in Manual v4.0.5-beta): Now that "safe_mysqld" has been renamed to
"mysqld_safe" it is probably a good idea to do a global search & replace (or
something to that effect) for "safe_mysqld" in the texinfo source of the manual.
Maybe keep around a v3.23.x manual on the website for users of that version.