Bug #53232 MySQL does not start with the Preference Pane on Mac OSX 10.6
Submitted: 28 Apr 2010 2:01 Modified: 29 Sep 2010 10:38
Reporter: Roberto Hidalgo Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Installing Severity:S2 (Serious)
Version:5.1.43, 5.1.46, 5.5.5-m3 OS:MacOS (10.6.3)
Assigned to: CPU Architecture:Any
Tags: mahelper prefPane, regression, snow leopard, startup

[28 Apr 2010 2:01] Roberto Hidalgo
Description:
After a clean install of Snow Leopard, doing an installation of MySQL versions either:
mysql-5.1.43-osx10.6-x86
mysql-5.1.43-osx10.6-x86_64
mysql-5.1.46-osx10.6-x86
mysql-5.1.46-osx10.6-x86_64
or mysql-5.5.3-m3-osx10.6-x86_64

I proceed to install the packages, then install the preference pane, and when trying to start MySQL, System Preferences hangs dumping this repeatedly on the log:
4/27/10 8:37:10 PM	authexec[6973]	executing /Users/rob/Library/PreferencePanes/MySQL.prefPane/Contents/Resources/mahelper
until I force quit System Preferences.

Starting/Stopping the server manually works like so:
sudo /usr/local/mysql/support-files/mysql.server start

/usr/local/mysql/data is owned by _mysql:wheel, by the way.

How to repeat:
Install Snow Leopard
Update OS
Install MySQL from DMG
Install the preference Pane by double clicking it
Click on start server
[28 Apr 2010 2:32] Roberto Hidalgo
Here's quick and dirty workaround, if anyone is interested:

mv ~/Library/PreferencePanes/MySQL.prefPane/Contents/Resources/mahelper ~/Library/PreferencePanes/MySQL.prefPane/Contents/Resources/mahelper.original

Then create the file in ~/Library/PreferencePanes/MySQL.prefPane/Contents/Resources/mahelper with this script:

#!/bin/bash
running=`stat /usr/local/mysql/data | grep "\-\- 28"`
if [ !$running ]; then
	sudo /usr/local/mysql/support-files/mysql.server start
else
	sudo /usr/local/mysql/support-files/mysql.server stop
fi
#end of script

Just remember to make it executable by doing:
chmod +x ~/Library/PreferencePanes/MySQL.prefPane/Contents/Resources/mahelper
[23 Jul 2010 8:43] Sierk Bornemann
I back and stress this bug also for MySQL 5.5.5m3 (mysql-5.5.5-m3-osx10.6-x86_64), please add this version to your bug's list:

I've made an upgrade from 5.5.3m3 (mysql-5.5.3-m3-osx10.6-x86_64) to 5.5.5m3 (mysql-5.5.5-m3-osx10.6-x86_64): installing the DMG/PKG of 5.5.5m3 over the 5.5.3m3 installation and then copying the data directory from 5.5.3m3 to the new location in the 5.5.5m3 directory (leaving the new performance_schema directory of 5.5.5m3 as is).

Clicking the MySQL PrefPane "Start MySQL Server": nothing happens.
Also "Automatically Star MySQL Server on Startup" fails with the log error message:

21.07.10 11:12:53 [0x0-0x3b03b].com.apple.systempreferences[1880]	/usr/local/mysql/support-files/mysql.server: line 256: my_print_defaults: command not found

Starting MySQL 5.5.5m3 with
$ 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)

Starting MySQl 5.5.5m3 with
$ sudo /usr/local/mysql/bin/mysqld_safe

that seems to be OK, MySQL server starts with

100723 10:22:15 mysqld_safe Logging to '/usr/local/mysql/data/xxx.local.err'.
usage: chown [-fhv] [-R [-H | -L | -P]] owner[:group] file ...
       chown [-fhv] [-R [-H | -L | -P]] :group file ...
100723 10:22:15 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

$ mysql -u root -p

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.5-m3-log MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 

PrefPane od 5.5.3m3, in particular the Startup Item of 5.5.3, worked for me.
In 5.5.5m3 both seem to be screwed.
Something strange must have happend and changed with the PrefPane and the StartupItem between 5.5.3m3 and 5.5.5m3.

How to work around? How to fix? How to fix at least the Startup Item, so that the MySQL Server daemon starts automatically? Go back to 5.5.3m3?
Changing your little mahelper script to use "/usr/local/mysql/bin/mysqld_safe" instead of "/usr/local/mysql/support-files/mysql.server start" since the later doesn't function either?

(Rapid) help/fix is welcome and needed.
[24 Jul 2010 9:59] Sierk Bornemann
I guess, the error is in /usr/local/mysql/support-files/mysql.server.

I've downloaded mysql-5.5.3-m3-osx10.6-x86_64.dmg (mysql-5.5.5-m3-osx10.6-x86_64 is installed) and unpacked it.

Then I've made da Diff to /usr/local/mysql/support-files/mysql.server, because the error message I get, is from mysql.server:

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
     /* ) ;;
bash-3.2$

Choosing the mysql.server file of mysql-5.5.3-m3-osx10.6-x86_64 and copying it over the one (after backing it up) shipped with mysql-5.5.5-m3-osx10.6-x86_64, all does very well, and all this does very well incl. well written log messages (which all didn't do before):

sudo /usr/local/mysql/support-files/mysql.server start|stop ✓
PreferencePane -> MySQL Start|Stop Server ✓
PreferencePane -> Automatically Start MySQL Server on Startup ✓

So, the error in hindering MySQL 5.5.5m3 starting correctly (in contrast to 5.5.3m3, where it did function without problems) seems to be this little line in the mysql.server file:

basedir=.

which should/must be:

basedir=/usr/local/mysql

And maybe additionally this line:

mysqld_pid_file_path=$datadir/`hostname`.pid

which should be better:

mysqld_pid_file_path=$datadir/`/bin/hostname`.pid

Maybe the same on the MySQL versions 5.1.43+ on MacOSX.

I don't know, if this Bug #53232 suffices to get the attention of Oracles's MySQL dev team, or if it would be better to file and raise a new bug concerning this topic and to foster an official patch on the trunk for all versions (maybe this might be a regression bug?).

And Roberto Hidalgo, please raise the severity of this bug from "non-critical" to something higher (if you are able to) to urge the MySQL dev team to fix this as soon as possible!

Thank you.
[24 Jul 2010 17:00] Roberto Hidalgo
Raised severity level as per Sierk Bornemann request.
[2 Aug 2010 12:57] Geert Vanderkelen
I just installed the MySQL package on MacOS X 10.6 and the Preference Pane works well. Here are my steps:
1) Download mysql-5.1.49-osx10.6-x86_64.dmg
2) Install mysql-5.1.49-osx10.6-x86_64.pkg
3) Install MySQLStartupItem.pkg
4) Install MySQL.prefPane

Push the Start button of MySQL to start: works. Push to stop: works.
BTW, this is also a clean install as I don't like to install on Mac using the DMG.

Works for me.
[2 Aug 2010 13:02] Sveta Smirnova
Roberto,

please try version 5.1.49 too so we can be sure problem solved for you as well.
[2 Aug 2010 14:54] Sierk Bornemann
Filed similar Bug #55530 http://bugs.mysql.com/bug.php?id=55530 concerning 5.5.5m3 versus 5.5.3m3.

What about that issue?
[1 Sep 2010 15:17] Bryan Sattler
Thanks Geert, you rock! I was racking my brains and scouring Google. Then I found your post. It worked like a charm!

Only thing different is that I had to uninstall the previous versions of MySQL. Found this article helpful http://tomkeur.net/39/how-to-remove-mysql-completely-mac-os-x-leopard.html
[29 Sep 2010 10:38] Sveta Smirnova
Duplicate of bug #51264
[29 Sep 2010 21:30] Larry D. Wilson
Apparently still an issue in release candidate 5.5.6-rc for OSX 64 bit. Server will start manually, just not with preference pane.
[16 Dec 2010 20:14] Rembert Oldenboom
Issue still exists with mysql 5.5.8 on brand new on mbp i7 2.8. With the comments of others the fix was easy:

Edit /usr/local/mysql/support-files/mysql.server
Search for "Set some defaults"
about 4 lines down, replace the line 

basedir=.

with

basedir=/usr/local/mysql

Then search for "Set pid file if not given"
about 3 lines down, replace the line

mysqld_pid_file_path=$datadir/`hostname`.pid

with

mysqld_pid_file_path=$datadir/`/bin/hostname`.pid

Now the prefPane will work.
[23 Dec 2010 12:04] Guillaume Serton
@Rembert

Thanks a lot, pref pane works after applying your fix
[30 Dec 2010 22:22] Levi Figueira
@Rembert

Setting the basedir was enough for me. No need to set pid path. :)
[31 Dec 2010 18:06] Mark Hilger
@Rembert - thanks!

As @Levi mentioned, setting basedir was all I had to do as well.  Pref Pane option now starts/stops and MySQL starts at boot.

Hope this gets resolved in a future release so I don't need to remember this hack.

Mac OS 10.5.8
MySQL 5.5.8
[17 Jan 2011 16:13] Michael Stern
I was getting so much grief trying to install 5.5.8 on my Macbook Air. This thread solved it for me -- changing basedir was sufficient.
[19 Jan 2011 20:58] Philip Sterling
@Rembert

Setting the basedir was enough for me. No need to set pid path. :)

Worked for me as well.  THANKS!!!!!