Getting MySQL Preference Pane To Work In Leopard

Posted by on Jan 30, 2008 in MySQL | 58 comments

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-file








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 simply 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

58 Comments

  1. Jx says:

    This is a fantastic fix! Thanks!

  2. Harlow says:

    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 says:

    Try using sudo in front of them like this:

    sudo mv mysql.server mysql.server.real

    and

    sudo touch mysql.server

  4. Harlow says:

    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 says:

    ^^ 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 says:

    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 says:

    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 says:

    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 says:

    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 says:

    Thanks for the tip… now I’m all set up again!

  11. Stuart Coyle says:

    This doesn’t work for me either. Not sure why, I’ll investgate a bit more…

  12. Stuart Coyle says:

    Fixed…
    I missed the $1 parameter in mysql.server

    Thanks for the fix. This had been bugging me for a while.

  13. Justin says:

    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 says:

    I restarted now it’s not working. Just get the system preferences to hang.

  15. jelveh says:
  16. Julian Smith says:

    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 says:

    Thanks very much!! This has saved alot of pain :)

  18. David says:

    I was looking for this solution for a lot of time… thank you very much

  19. Lars says:

    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/MySQL.prefPane-leopardfix.zip

    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">this 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 says:

    Great! It works like a charm!

  21. Will says:

    Awesome. The new preference pane works! Thanks everyone for the posts.

  22. Larry Lowe says:

    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 says:

    thanks!!!!!!!!!!!!!!!!

  24. Big Spoon says:

    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 says:

    yes! Updated preference pane posted by Lars fixed the hangup.

  26. Alfio Raymond says:

    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 says:

    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 says:

    A shame that this is necessary – but thanks for the tip!

  29. keiji says:

    This entry is very useful for me!!! Thanks!!!

  30. stefan burt says:

    Thank you, I just wasted pretty much an hour or two with this problem thank you for the fix !!!

  31. Scott Watson says:

    Excellent work. Thanks!!

  32. Edward Glasheen says:

    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 says:

    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 says:

    thanks for this, really helped a young developer out

  35. Mogi says:

    Thank You SO MUCH! You saved my day!

  36. Bob says:

    Thanks so much – you totally saved me there.

  37. Per Ejeklint says:

    You saved my day, many thanks!

  38. Ofeargall says:

    Thank you! Never would have found the info without this help.

  39. Eric Broyles says:

    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 says:

    Wonderful! It works perfectly. Why don’t you propose the fix to the MySQL team? :-)

  41. Sebastien says:

    Excellent fix Thanks a lot !

  42. Daniel says:

    THANKS! That was super-useful.

  43. Diego says:

    Works!!! Thank you so much!!

  44. lucy says:

    How do you remove mySQL ?

    I updated but no longer need mysql.

  45. Danchik says:

    Just wanted to add my thanks here!!!

  46. Andy says:

    You rock!! This fix works works great!

  47. sli says:

    Thank you so much !

  48. biempi says:

    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 says:

    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 says:

    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 says:

    The latest MySQL installer seems to work fine with Leopard, PrefPane and everything.

  52. Juanjo says:

    This is a fantastic ——- UPDATE ——— :D

    By the way. It might be first in the post… But thanks.

  53. spill says:

    You own.

    Thanks for giving me one solution/reason to not wipe this MBP and go back to Tiger tonight.

  54. AK says:

    FAB UPDATE!! thank the unix gods – though I did learn quite a bit poking around in TERMINAL. :)

  55. Guy says:

    I installed the Mysql Package as you suggested on Leopard v.10.5.4. Mysql icon never appeared in my system prefs. Any thoughts on how to get it there?

    This worked fine for me on Tiger.

  56. yuri says:

    awesome. thanks!!!

  57. Ben says:

    Thanks for everyone’s input.

    I tried the above suggestions to get the MySQL Preference Pane fixed, but it was not working.

    So, I decided to install the newest version of the MySQL community server from http://www.mysql.com.

    After downloading the 10.5 package, I double clicked on the MySQLStartupItem.pkg and installed it.

    Next, I double clicked on the MySQL.prefPane, and the installed alerted me that I had an old version of the preference pane installed. It then politely asked if I would like to overwrite the old version. I selected “yes”, and it installed the newest version.

    After these steps, the preference pane worked again! No terminal required!

    I DID NOT INSTALL THE NEWEST .pkg VERSION OF MYSQL, just the MySQLStartupItem.pkg and MySQL.prefPane. I was satisfied with my current version of MySQL, so I decided not to go through the process of installing a newer version.

    Hope this helps!

  58. Scott says:

    I located an interesting fix here:

    http://www.bytebot.net/blog/archives/2008/04/06/mysql-on-leopard-os-x-105-prefpane-fixed

    Colin has uploaded a new prefpane with a fix here: ftp://ftp.mysql.com/pub/mysql/download/gui-tools/MySQL.prefPane-leopardfix.zip

    I replaced and mysql server worked like a charm.

Leave a Reply

Leave a Reply

*