Tuesday, September 05, 2006

 

Upgrading mysql on Tiger

After a system crash I've bought a MacBookPro and have ALL of my settings and preferences imported onto it from my iBook (running 10.3.9). The only thing that hasn't come across seamlessly (so far?) is mysql. Apparently there are different binaries for Panther and Tiger, so I need to reinstall.

First, I removed the old mysql from my system by backing up the following to a "mysql old" folder:

/Library/MySQL
/Library/StartupItems/MySQL
/Library/Receipts/MySQL.pkg

This at least means I have a full backup of my data.

Secondly, I downloaded the binary from dev.mysql.com and installed it. I could've used mysql 5 but am sticking with 4 because I like it (and because all of my old tables are in that format - I don't have sql exported versions I can use for importing).

Installed mysql-standard, the MySQLStartupItem and the MySQL.prefPane (for controlling mysql through System Preferences). Then I started mysql through terminal (open it up, type "cd /usr/local/mysql" then "sudo ./bin/mysqld_safe" and it should start up) although the instructions I'm following advocate a full reboot. Seeing that I can't seem to get php talking to mysql, reboot time it is.

After rebooting although ./bin/mysqlcheck -p -A -r now works, I still can't get apache/php talking to mysql. Downloaded a Dashboard app called TailDash which gives me the output of my log files (httpd, error_log etc). Nothing obvious.

Ah ha! According to a comment at MacDevCenter, "After updating to Mac OS X 10.4.4, you may find that the connection between PHP and MySQL running on your local webserver is broken. Apparently the socket file got moved in the update." (see osxhints article)

The fix is quite simple:

sudo mkdir -p /var/mysql
sudo chgrp mysql /var/mysql
sudo chmod g+w /var/mysql

edit/create /private/etc/my.cnf and add the lines:

[mysqld]
socket=/var/mysql/mysql.sock
[client]
socket=/var/mysql/mysql.sock

restart mysql

And it works! Hooray!

Technorati Tags: , , ,


This page is powered by Blogger. Isn't yours?