Upgrading from Mac OS 10.4 (Tiger) to 10.5 (Leopard) seems to throttle the MySQL setup, but it is relatively easy to fix. The problem is MySQL can no longer find the correct socket to bind to, failing with the error like this:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Its looking to bind to its socket at ‘/var/mysql/mysql.sock’, it can be fixed by either soft linking the socket (while running MySQL in safe mode - via ‘safe_mysqld’):
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
but it’s a bit of a hack, it’s probably better to address the configuration issue by telling MySQL where the socket is directly. Edit either the global config (/etc/my.cnf) or the server config ($PATH_TO_MYSQL/my.cnf) and add/edit the socket directive:
[client]
socket = /var/mysql/mysql.sock
[mysqld]
socket = /var/mysql/mysql.sock
Then creating the mysql directory:
sudo mkdir /var/mysql && chown _mysql /var/mysql
Then start the server in the usual way using the startup script (it can be found in $PATH_TO_MYSQL/support-files/mysql.server if you haven’t moved it since the install):
sudo /etc/init.d/mysqld start
After that you should be able to control starting/stopping from the preference pane should you want to.
If you are using PHP with MySQL and connecting through the named socket rather than the TCP port you will also need to amend the ‘mysql.default_socket’ directive in ‘/etc/php.ini’ and set it to the same socket value as specified in ‘my.cnf’
⊗ November 02, 2007, 10:44pm