Getting MySQL Preference Pane To Work In Leopard

The most visited post on my blog is the post regarding a fix for getting MySQL to run on Leopard. Today, Charlie Jackson posted a comment to that post with a fix he discovered for getting the preference pane to work so you no longer have to start/stop MySQL via the commandline. So that it wouldnt be buried in the comments, I decided to post it here.

First, open a terminal window and enter the following commands:

cd /usr/local/mysql/support-files

mv mysql.server mysql.server.real

touch mysql.server

Next, you will need to edit the new mysql.server file that we just created with the touch command. I used textmate by simly typing "mate mysql.server", but you could use vi or whatever you want.

Once you have the file open for editing, simply enter the following code into the file and save it.

#!/bin/sh

sudo /usr/local/mysql/support-files/mysql.server.real $1

Once this was done, I had to change the permissions on the file to get it to work so I ran the following in the terminal:

sudo chown root:wheel mysql.server

sudo chmod +x mysql.server

After that, fire up your system preferences and test the MySQL pane. Mine starts and stops the server perfectly.

Thanks again Charlie!

----- UPDATE! ------

Lars posted in the comments below a link to a patched pref pane that has been FINALLY released! Thanks for pointing this out Lars!

I have installed it on both my 24" iMac and my MBP and it works great!

Grab it here


Related Blog Entries

Feel free to Leave a Comment or just read what others have to say

51 Comments so far

  1. Jx 1/30/08 3:15 PM
    Jx's Gravatar This is a fantastic fix! Thanks!
  2. Harlow 1/31/08 3:10 PM
    Harlow's Gravatar I keep getting a permission denied message when i do the "mv" and "touch" commands. I made sure that mysql was stopped before I attempted the above commands. Any suggestions? This is the LAST little piece to my LAMP stack... so close!
  3. Russ Johnson 1/31/08 3:38 PM
    Russ Johnson's Gravatar Try using sudo in front of them like this:

    sudo mv mysql.server mysql.server.real

    and

    sudo touch mysql.server
  4. Harlow 2/1/08 3:13 AM
    Harlow's Gravatar Yup the "sudo" fixed that problem.

    However, its still not working... the mysql pref pane just gives me neverending pin-wheel when I either Start or Stop. I can start through command line, so I guess that will have to do for the time being. Really strange cause I got this whole setup to work flawlessly a few weeks ago on my other mac.
  5. Pete 2/3/08 11:03 AM
    Pete's Gravatar ^^ Exactly the same here. The fix seemed to work at first, but after a restart the prefs pane is just giving me a never-ending pinwheel.
  6. Julian Smith 2/3/08 6:56 PM
    Julian Smith's Gravatar Yes, me too.
    After restart the thing won't work.

    If I start mysql using Terminal, then the preference panel works fine, but it won't work if I haven't manually started mysql.

    Any ideas?
  7. Russ Johnson 2/4/08 9:12 AM
    Russ Johnson's Gravatar Hmmm... not really sure. Mine is working fine. I would check the permissions and owner of the new file you created to make sure its the same as the old file. Just to make sure its not a permissions issue.
  8. Julian Smith 2/4/08 5:10 PM
    Julian Smith's Gravatar Oh. Er, I'm a bit of a dunce with this 'under the hood' stuff…

    These are the permissions for the things in the 'support-files' directory:

    -rw-r--r-- 1 root wheel 3316 14 Jan 20:07 MySQL-shared-compat.spec
    -rw-r--r-- 1 root wheel 3383 12 Jan 01:43 compiler_warnings.supp
    -rw-r--r-- 1 root wheel 773 12 Jan 01:43 magic
    -rw-r--r-- 1 root wheel 4933 14 Jan 20:07 my-huge.cnf
    -rw-r--r-- 1 root wheel 20910 14 Jan 20:07 my-innodb-heavy-4G.cnf
    -rw-r--r-- 1 root wheel 4909 14 Jan 20:07 my-large.cnf
    -rw-r--r-- 1 root wheel 4916 14 Jan 20:07 my-medium.cnf
    -rw-r--r-- 1 root wheel 2486 14 Jan 20:07 my-small.cnf
    -rwxr-xr-x 1 root wheel 41921 14 Jan 20:07 mysql-5.0.51a.spec
    -rwxr-xr-x 1 root wheel 839 14 Jan 20:07 mysql-log-rotate
    -rwxr-xr-x 1 root wheel 68 3 Feb 17:13 mysql.server
    -rwxr-xr-x 1 root wheel 11147 14 Jan 20:08 mysql.server.real
    -rw-r--r-- 1 root wheel 41921 14 Jan 20:07 mysql.spec
    -rw-r--r-- 1 root wheel 926 14 Jan 20:07 mysqld_multi.server
    -rw-r--r-- 1 root wheel 589 14 Jan 20:07 ndb-config-2-node.ini

    So those two files are -rwxr-xr-x. Is this what they should be? (I included the others just in case they had any impact.)

    Otherwise, it's the same. After restarting the machine if I try and use the preference panel to turn it on, I get the infinite pinwheel and have to force quit system preferences ("not responding").

    If I start safe_mysqld in terminal, it all comes good again.

    Any ideas? (I have just erased and installed Leopard, with minimal extras.)
  9. Jason Sims 2/5/08 11:43 AM
    Jason Sims's Gravatar This doesn't work for me either. I'm running MySQL 5.0.51a on Mac OS X 10.5.1. The server starts up and works fine when started with "safe_mysqld &", and the preference pane correctly shows whether the server is running or not. But after applying the above fix, I too get the "beachball of death" when I try to start (or stop) the server using the preference pane, and System Preferences must then be force-quit. I just put everything back the way it was; the preference pane doesn't work, but at least if I click the button, it simply does nothing instead of causing System Preferences to lock up.
  10. dg 2/6/08 7:59 PM
    dg's Gravatar Thanks for the tip… now I'm all set up again!
  11. Stuart Coyle 2/7/08 8:10 PM
    Stuart Coyle's Gravatar This doesn't work for me either. Not sure why, I'll investgate a bit more...
  12. Stuart Coyle 2/7/08 8:12 PM
    Stuart Coyle's Gravatar Fixed...
    I missed the $1 parameter in mysql.server

    Thanks for the fix. This had been bugging me for a while.
  13. Justin 2/7/08 8:15 PM
    Justin's Gravatar Thank you, thank you, thank you!
    It was driving me nuts that I couldn't use the pref pane to start/stop mysql! I was about to write an automator app to run the command line actions, but I thought that would be unnecessary.
    Now the pref pane works like it should!
  14. Stuart Coyle 2/8/08 4:14 AM
    Stuart Coyle's Gravatar I restarted now it's not working. Just get the system preferences to hang.
  15. jelveh 2/9/08 1:56 AM
  16. Julian Smith 2/10/08 5:36 PM
    Julian Smith's Gravatar I tried changing the mysql user to _mysql, but it didn't make a difference. Still the hang time.

    I remember reading somewhere in my scourings that yes, the user has changed to have the extra underscore, but that either 'mysql' or '_mysql' works (i.e. they're interchangeable) – unfortunately I can't remember where I read it …

    Still, once I've started mysql using the Terminal, the preference pane comes good and all is rosy - a bit of a pain, but it only takes a few seconds …
  17. Nicholas Jacka 2/12/08 4:34 PM
    Nicholas Jacka's Gravatar Thanks very much!! This has saved alot of pain :)
  18. David 2/15/08 1:11 PM
    David's Gravatar I was looking for this solution for a lot of time... thank you very much
  19. Lars 2/16/08 1:28 AM
    Lars's Gravatar Since this post is the #1 hit which comes up on google when you combine search terms "MySQL" "Leopard" (at least that's what I think I used to get here), I thought you might be interested in the following:

    ftp://ftp.mysql.com/pub/mysql/download/gui-tools/M...

    MySQL finally (FINALLY!) fixed the goddamn pref pane. However, the guy who points us to this - a commenter to <a href="http://bugs.mysql.com/bug.php?id=28854">th... post</a> (Alfredo Kojima), also points out that the OTHER problem with many Leopard installs of MySQL not working right (or not working at all) was that the MySQL data directory had incorrect permissions on it. The fix for that is: sudo chown -R mysql:wheel /usr/local/mysql/data

    Hope this helps anyone still having trouble. Worked for me.
  20. Anders Lemke 2/18/08 6:50 AM
    Anders Lemke's Gravatar Great! It works like a charm!
  21. Will 2/19/08 11:12 PM
    Will's Gravatar Awesome. The new preference pane works! Thanks everyone for the posts.
  22. Larry Lowe 2/21/08 10:18 AM
    Larry Lowe's Gravatar Outstanding! FINALLY, I have MySQL 5.0.51-a-osx10.4-i686 running on my MacBook Pro on OS X 10.5.2.

    This plus PHP and Apache put me in business.

    Thanks for this thread and all this information.
  23. Steven 2/22/08 11:49 AM
    Steven's Gravatar thanks!!!!!!!!!!!!!!!!
  24. Big Spoon 2/23/08 8:50 AM
    Big Spoon's Gravatar thanks for looking into this. I was getting tired of starting and stopping from the command line. I did the original fix to this post then updated to Lars' fix. both worked great.
  25. Jables 2/25/08 10:35 PM
    Jables's Gravatar yes! Updated preference pane posted by Lars fixed the hangup.
  26. Alfio Raymond 2/26/08 12:07 AM
    Alfio Raymond's Gravatar Pref pane option worked great for me so psyched to have this back than using MAMP or always pulling up terminal to start and stop mySQL.
  27. Catigata 3/1/08 4:45 PM
    Catigata's Gravatar For those who are unsettled about these commands and are still not having it work:

    When you change the permissions on the created file in the instructions using:

    sudo chown root:wheel mysql.server

    change "root" to whatever your current admin username is.
    for example
    sudo chown tferguson:wheel mysql.server
  28. Brian Leonard 3/3/08 3:13 PM
    Brian Leonard's Gravatar A shame that this is necessary - but thanks for the tip!
  29. keiji 3/7/08 5:48 AM
    keiji's Gravatar This entry is very useful for me!!! Thanks!!!
  30. stefan burt 3/7/08 7:13 AM
    stefan burt's Gravatar Thank you, I just wasted pretty much an hour or two with this problem thank you for the fix !!!
  31. Scott Watson 3/14/08 12:01 PM
    Scott Watson's Gravatar Excellent work. Thanks!!
  32. Edward Glasheen 3/16/08 7:43 PM
    Edward Glasheen's Gravatar Thanks for all the hard work. Anyone know of a good GUI Tool that I can use. MySql is still showing 10.4. Navicat is Leopard compatible but is $79.

    Thanks, Ed
  33. Russ Johnson 3/16/08 9:11 PM
    Russ Johnson's Gravatar I use Cocoa MySQL for the most part. Sometimes AquaData Studio Opensource license when Im working on my OS projects but I dont use it that much.
  34. douche 3/17/08 1:49 PM
    douche's Gravatar thanks for this, really helped a young developer out
  35. Mogi 3/17/08 7:53 PM
    Mogi's Gravatar Thank You SO MUCH! You saved my day!
  36. Bob 3/20/08 12:04 PM
    Bob's Gravatar Thanks so much - you totally saved me there.
  37. Per Ejeklint 3/24/08 4:56 AM
    Per Ejeklint's Gravatar You saved my day, many thanks!
  38. Ofeargall 3/26/08 10:38 AM
    Ofeargall's Gravatar Thank you! Never would have found the info without this help.
  39. Eric Broyles 3/27/08 2:15 PM
    Eric Broyles's Gravatar The tip from Lars with the permissions change on /usr/local/mysql/data fixed the problem I was having with the hanging System Preferences. Thanks to all!
  40. Pietrodn 3/28/08 12:11 PM
    Pietrodn's Gravatar Wonderful! It works perfectly. Why don't you propose the fix to the MySQL team? :-)
  41. Sebastien 3/28/08 4:34 PM
    Sebastien's Gravatar Excellent fix Thanks a lot !
  42. Daniel 4/1/08 4:40 PM
    Daniel's Gravatar THANKS! That was super-useful.
  43. Diego 4/8/08 7:46 AM
    Diego's Gravatar Works!!! Thank you so much!!
  44. lucy 4/9/08 11:38 AM
    lucy's Gravatar How do you remove mySQL ?

    I updated but no longer need mysql.
  45. Danchik 4/11/08 11:42 AM
    Danchik's Gravatar Just wanted to add my thanks here!!!
  46. Andy 4/14/08 12:32 AM
    Andy's Gravatar You rock!! This fix works works great!
  47. sli 4/16/08 8:33 AM
    sli's Gravatar Thank you so much !
  48. biempi 4/21/08 6:38 AM
    biempi's Gravatar Hi,
    first of all thanks to Lars and the Pref-Pane-Fix.
    I found out (thanks to an Italian blog) how to fix the startup issue.
    You have to move MYSQLCOM to /Library/StartupItems/

    type in Terminal:

    sudo mv /usr/local/MySQLCOM /Library/StartupItems/

    Now everytime you shut down or reboot MYSQL will automatically start (if checked in the Pref-Pane)

    Cheers

    tnx to ideafactory.it
  49. Pete 4/21/08 8:38 AM
    Pete's Gravatar To edit in these lines into your file....

    #!/bin/sh

    sudo /usr/local/mysql/support-files/mysql.server.real $1

    Russ gave this command: mate mysql.server

    It didn't work for me so i found an alternative command instead of mate I used "pico" I also had to add sudo before each of my commands

    so this is what it looked like: sudo pico mysql.server
  50. Stephanie Barone 4/22/08 9:06 AM
    Stephanie Barone's Gravatar Thanks so much for the pref pane fix and for all the other fixes from the other commentors, especially the one about the MySQLCOM in the startup items folder. I wondered where the heck that went when I installed it!
  51. Oskar Lissheim-Boethius 4/28/08 8:33 PM
    Oskar Lissheim-Boethius's Gravatar The latest MySQL installer seems to work fine with Leopard, PrefPane and everything.