Archive for August, 2009

Snow Leopard breaks MySQL

Monday, August 31st, 2009

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:

ls

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 &