Bug #55530 Change in mysql.server (basedir, mysqld_pid_file_path) prevents MySQL to start
Submitted: 24 Jul 2010 10:30 Modified: 29 Sep 2010 14:28
Reporter: Sierk Bornemann Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Installing Severity:S2 (Serious)
Version:5.5.5m3, 5.5.6 rc OS:Mac OS X (10.6.4)
Assigned to:
Tags: mahelper prefPane, mysql.server, regression, snow leopard, startup

[24 Jul 2010 10:30] Sierk Bornemann
Description:
MySQL 5.5.5m3 doesn't start as intended.
Neither via Prefpane nor directly invoked via the mysql.server script.

Starting MySQL 5.5.5m3 via PrefPane or directly via
$ sudo /usr/local/mysql/support-files/mysql.server start

the following error message occurs:

/usr/local/mysql/support-files/mysql.server: line 256: my_print_defaults: command not found
Starting MySQL
ERROR! Couldn't find MySQL server (./bin/mysqld_safe)

See also: Bug #53232 "MySQL does not start with the Preference Pane on Mac OSX 10.6"

How to repeat:
Install MYSQL 5.5.3 (mysql-5.5.3-m3-osx10.6-x86_64.dmg) with PrefPane and StartupItem.
Copy /usr/local/mysql/support-files/my-medium.cnf to /etc/my.cnf.
Expand my.cnf with this line:

[mysqld_safe]
log-error = /usr/local/mysql/data/mysqld.err

Try to start the MySQL 5.5.5m3 server with:

$ sudo /usr/local/mysql/support-files/mysql.server start
Result: Fail.

$ sudo /usr/local/mysql/bin/mysqld_safe
Result: Success.

Go into the PreferencePanes of MacOSX:
PrefPane MySQL -> Start MySQL Server
Result: Fail.

PrefPane MySQL -> Automatically Start MySQL Server on Startup -> Reboot
Result: Fail.

The written log files reflect the fail (if written at all).

Suggested fix:
Choose mysql.server of MySQL 5.5.3m3 instead of the one shipped with MySQL 5.5.5m3 -- or precisely use:

basedir=/usr/local/mysql
mysqld_pid_file_path=$datadir/`/bin/hostname`.pid

in mysql.server.

See the Diff:

bash-3.2$ diff -u mysql.server.5_5_3m3 mysql.server.5_5_5m3 
--- mysql.server.5_5_3m3	2010-03-25 06:10:41.000000000 +0100
+++ mysql.server.5_5_5m3	2010-07-06 20:55:40.000000000 +0200
@@ -25,7 +25,7 @@
 # Description: MySQL is a very fast and reliable SQL database engine.
 ### END INIT INFO
  
-# If you install MySQL on some other places than /usr/local/mysql, then you
+# If you install MySQL on some other places than ., then you
 # have to do one of the following things for this script to work:
 #
 # - Run this script from within the MySQL installation directory
@@ -63,7 +63,7 @@
 mysqld_pid_file_path=
 if test -z "$basedir"
 then
-  basedir=/usr/local/mysql
+  basedir=.
   bindir=./bin
   if test -z "$datadir"
   then
@@ -260,7 +260,7 @@
 #
 if test -z "$mysqld_pid_file_path"
 then
-  mysqld_pid_file_path=$datadir/`/bin/hostname`.pid
+  mysqld_pid_file_path=$datadir/`hostname`.pid
 else
   case "$mysqld_pid_file_path" in
     /* ) ;;

After changing the above:

$ sudo /usr/local/mysql/support-files/mysql.server start
Result: Success.

$ sudo /usr/local/mysql/bin/mysqld_safe
Result: Success.

Go into the PreferencePanes of MacOSX:
PrefPane MySQL -> Start MySQL Server
Result: Success.

PrefPane MySQL -> Automatically Start MySQL Server on Startup -> Reboot
Result: Success.

The written log files reflect the success.
[24 Jul 2010 11:24] Sierk Bornemann
Added "regression" to the Tags
[29 Sep 2010 10:33] Susanne Ebrecht
This seems to be related to bug #57062
[29 Sep 2010 10:38] Susanne Ebrecht
The prefPane problem is a duplicate of bug #51264
The problem of my_print_defaults is a duplicate of 57062
[29 Sep 2010 14:28] Sierk Bornemann
Additionally, see also bug #57099 (False permissions of MySQL StartupItem on MacOSX prevent launchd to start MySQL)