Leopard and MySQL (OS X)

From The System Administrator Zone

This is a work in progress as I've just installed it this weekend and am still working out the bugs.

Restarting on Reboot

Needs verification:

/usr/local/mysql/support-files/mysql.server

On line 62 change user=mysql to user=_mysql.


PHP5

PHP will not be able to find the MySQL socket file. Edit /etc/php.ini and change the entry to /private/tmp/mysql.sock. The default, if left blank, is /var/mysql/mysql.sock.

; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
mysql.default_socket = /private/tmp/mysql.sock

Then restart apache to activate the change.

$ sudo apachectl restart

If this doesn't work, after restarting Apache, check to see if it is using /usr/local/php5/lib/php.ini.

Socket location revisited

All of the above was based on note-on-the-net... But, it didn't work.

I updated /etc/php.ini to include:

mysql.default_socket = /tmp/mysql.sock

I created a /etc/my.cnf file to include:

socket		= /tmp/mysql.sock

Looking at the mysql log file, I verified that the socket was in that location:

# grep socket /usr/local/mysql/data/HOSTNAME.local.err
Version: '5.0.45'  socket: '/tmp/mysql.sock'  port: 3306  MySQL Community Server (GPL)

Yet, phpMyAdmin still responded with a:

#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)

The fix is unexplained:

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

Menalto's Gallery2

There doesn't seem to be a place in the Gallery2 configuration to change its pointer to the MySQL socket location. You will get an error complaining that the socket at /tmp/mysql.sock is missing. Add a symbolic link from the real socket at /private/tmp/mysql.sock and things will work.

$ sudo ln -s /private/tmp/mysql.sock /tmp/mysql.sock