logo logo

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

<p>mv mysql.server mysql.server.real</p>

 

 

 

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

bottom

58 Comments »

  1. Jx Jx Says:
    This is a fantastic fix! Thanks!
  2. Harlow 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 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 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 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 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 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 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 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 dg Says:
    Thanks for the tip… now I'm all set up again!
  11. Stuart Coyle Stuart Coyle Says:
    This doesn't work for me either. Not sure why, I'll investgate a bit more...
  12. Stuart Coyle 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 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 Stuart Coyle Says:
    I restarted now it's not working. Just get the system preferences to hang.
  15. jelveh jelveh Says:
  16. Julian Smith 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 Nicholas Jacka Says:
    Thanks very much!! This has saved alot of pain :)
  18. David David Says:
    I was looking for this solution for a lot of time... thank you very much
  19. Lars 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 Anders Lemke Says:
    Great! It works like a charm!
  21. Will Will Says:
    Awesome. The new preference pane works! Thanks everyone for the posts.
  22. Larry Lowe 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 Steven Says:
    thanks!!!!!!!!!!!!!!!!
  24. Big Spoon 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 Jables Says:
    yes! Updated preference pane posted by Lars fixed the hangup.
  26. Alfio Raymond 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 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 Brian Leonard Says:
    A shame that this is necessary - but thanks for the tip!
  29. keiji keiji Says:
    This entry is very useful for me!!! Thanks!!!
  30. stefan burt 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 Scott Watson Says:
    Excellent work. Thanks!!
  32. Edward Glasheen 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 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 douche Says:
    thanks for this, really helped a young developer out
  35. Mogi Mogi Says:
    Thank You SO MUCH! You saved my day!
  36. Bob Bob Says:
    Thanks so much - you totally saved me there.
  37. Per Ejeklint Per Ejeklint Says:
    You saved my day, many thanks!
  38. Ofeargall Ofeargall Says:
    Thank you! Never would have found the info without this help.
  39. Eric Broyles 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 Pietrodn Says:
    Wonderful! It works perfectly. Why don't you propose the fix to the MySQL team? :-)
  41. Sebastien Sebastien Says:
    Excellent fix Thanks a lot !
  42. Daniel Daniel Says:
    THANKS! That was super-useful.
  43. Diego Diego Says:
    Works!!! Thank you so much!!
  44. lucy lucy Says:
    How do you remove mySQL ?

    I updated but no longer need mysql.
  45. Danchik Danchik Says:
    Just wanted to add my thanks here!!!
  46. Andy Andy Says:
    You rock!! This fix works works great!
  47. sli sli Says:
    Thank you so much !
  48. biempi 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 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 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 Oskar Lissheim-Boethius Says:
    The latest MySQL installer seems to work fine with Leopard, PrefPane and everything.
  52. Juanjo Juanjo Says:
    This is a fantastic ------- UPDATE --------- :D

    By the way. It might be first in the post... But thanks.
  53. spill spill Says:
    You own.

    Thanks for giving me one solution/reason to not wipe this MBP and go back to Tiger tonight.
  54. AK AK Says:
    FAB UPDATE!! thank the unix gods - though I did learn quite a bit poking around in TERMINAL. :)
  55. Guy 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 yuri Says:
    awesome. thanks!!!
  57. Ben 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 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 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 comment