Fix for MySQL on Leopard

After upgrading, I found that there are a few incompatibilities with several applications. Thats to be expected I guess. The two biggies for me is CF 8 and MySQL. I havent managed to get CF 8 running yet but I found a fix for MySQL.

It seems that the preference pane will not work to start or stop MySQL yet so you will have to start it manually from the command line and create a link to the socket file.

First, start MySQL in a terminal window with the following command:

sudo /usr/local/mysql/bin/safe_mysqld

Then either close the terminal and open a new one, or just hit Command-N to open a new terminal window. Then type the following:

sudo mkdir /var/mysql/

And lastly, create a symbolic link to point the default socket file:

sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock

I will keep posting things as I find problems and fixes.

–== UPDATE ==–

Charlie Jackson posted a fix for getting the preference pane to work. I have posted a write up of the fix here.

39 thoughts on “Fix for MySQL on Leopard”

  1. you may also want to add this line:


    to your /etc/hostconfig file… allowing the MySQLCOM startup item to properly start mysql when the system is booted.

  2. Alternatively, to get PHP working (specifically phpMyAdmin) I copied /etc/php.ini.default to /etc/php.ini and modified the mysql.default.socket and mysqli.default.socket lines to point to /tmp/mysql.sock.

  3. I am doing a fresh install and I can’t get past the initial instruction above. So frustrating..

    071202 15:53:55 mysqld_safe Logging to ‘/usr/local/mysql/data/Power-Mac-G5.local.err’.
    /usr/local/mysql/bin/safe_mysqld: line 366: [: -eq: unary operator expected
    071202 15:53:55 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
    071202 15:53:58 mysqld_safe mysqld from pid file /usr/local/mysql/data/ ended

  4. Wow what a relief, I have been trying all the other fixes I came across on the net and this one did the job quick and easy. A million thanks 😉

  5. Wow was that ever easy. I searched for a long time and found all sorts of confusing things but this one was simple and worked first try. Thanks a buch!

  6. Wow, usually doing something this simple never ends up working for me. Great fix! I would love to see a bit more of an explanation of what was done. Thanks none the less though.

  7. I also had the same trouble with the MySQL preference pane (pain?). After much poking around, I found that the pref. pane was calling /usr/local/mysql/support-files/mysql.server

    Furthermore, it was trying to run it as me (even though I was prompted for a password).

    To get it running, I did the following:

    – Rename mysql.server to mysql.server.real

    – Create a one-line /bin/sh script called mysql.server with the following:

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

    This hack seems to have fixed the problem for me.

    — Charlie

  8. Having implemented Hasani Hunter’s solution to the startup problem, your prefpane fix doesn’t seem to work. Briefly, Hasani advocates chgrping & chowning everything in the MySQL install dir as _mysql, then creating a daemon plist for launchctl to use. You then start & stop MySQL with "sudo launchctl [load|unload] com.mysql.mysqld.plist" & voila, it works. This gets you past the bug where mysql lacks the privs to read/write to/from its own directories, but the prefpane – despite asking you for an admin password – doesn’t seem to do anything.

Leave a Reply

Your email address will not be published. Required fields are marked *