Snow Leopard breaks MySQL

If you already have a MySQL installation on your Mac Leopard system, upgrading to Snow Leopard causes a minor problem.

When the MySQL database server software is installed, it creates a directory, in the /usr/local/ directory, with a name that contains the version information, for example, mysql-5.1.37-osx10.5-x86. It also creates a symbolic link to that directory that looks like this: mysql -> mysql-5.1.37-osx10.5-x86

The symbolic link is simply a short name that points to the actual directory with the long name, similar to a Mac OS X alias. For some reason, when Snow Leopard is installed, it wipes out this symbolic link. The long-named directory and all of its contents remain untouched, but there is no longer the short name “mysql” pointing to it. This may prevent applications from connecting to the MySQL server. The following steps will fix the problem:

1. Open a terminal window and become the OS X system root user, by entering the ‘su’ command and then entering your system root user password. If you have not already enabled your system root user, here is how to do it:

  • Choose Apple menu > System Preferences and click Accounts.
  • Open Accounts preferences
  • Click Login Options.
  • Click either Edit or Join in the Network Account Server section.
  • Click Open Directory Utility.
  • Click the lock icon to unlock it, and then enter your administrator name and password.
  • Choose Edit > Enable Root User, and then enter a root password in the Password and Verify fields.

2. Execute the following commands on the command line:

cd /usr/local
ln -s mysql-5.1.37-osx10.5-x86 mysql

Your installation may have a different version number in the directory name, so you will have to check to see what your directory is named. You can do this by listing the contents of /usr/local with this command:


That’s all there is to it. Once this is done, you can close the terminal window. You also may have to start up the MySQL server. You can do this with the MySQL pane in Systems Preference that you installed when you installed MySQL, or you can always start up the MySQL server on the command line in a terminal window like so:

mysqld_safe &

2 Responses to “Snow Leopard breaks MySQL”

  1. Paul Corr says:

    If you are just doing one task requiring root privileges, like creating this symlink, couldn’t it be more simply done using ‘sudo’?

    $ cd /usr/local
    $ sudo ln -s mysql-5.1.37-osx10.5-x86 mysql

    If you are in an administrator’s account, you give that password at the prompt and you should be good to go. (If it is the first time using it, you will see a warning asking if you know what you are doing. i.e., running a privileged command.)

    Having an enabled root account would add some vulnerability as another avenue of attack, I would think and best avoided if possible.

  2. Rob Lewis says:

    I’ve got Snow Leopard installed (upgrade) and my symbolic link is there. MySQL has been working fine. It was installed before I upgraded the OS. So apparently this doesn’t affect everybody.

Leave a Reply