stocksy.co.uk
"now nearly rectum-free!"

Search

Google
the Web  this site only

Links

MySQL 5 on OS X 10.5.x Leopard

24th Apr 2008, 07:36:17 PM

Compared with previous releases, MySQL 5 on OS X 10.5 is a bit rough round the edges. Here's how I got it going:

Fetch the installer from dev.mysql.com. Install the MySQL server package, but don't bother with the Startup Item or the Preference Pane - they are broken on Leopard.

Next, grab the fixed version of the Preference Pane, then install it. You can now use it to start MySQL the server.

If you intend to use any of the MySQL command line tools, edit your paths file (sudo vi /etc/paths) and add /usr/local/mysql/bin. Secondly, edit your manpaths file (sudo vi /etc/manpaths) and add /usr/local/mysql/man.

It's worth securing it a bit at this stage:

mysqladmin -u root password 'thepassword'

mysql -u root -p mysql
DELETE FROM user WHERE user = '';
DELETE FROM user WHERE user = 'root' and password = '';
flush privileges;
drop database test;

If you need MySQL to start on boot, it's best to use launchd. Create the following file:

sudo vi /Library/LaunchDaemons/com.mysql.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>KeepAlive</key>
	<true/>
	<key>Label</key>
	<string>com.mysql</string>
	<key>Program</key>
	<string>/usr/local/mysql/bin/mysqld_safe</string>
	<key>RunAtLoad</key>
	<true/>
</dict>
</plist>
</pre>

launchd will pick this up on the next reboot, or you can do it manually:

sudo launchctl load /Library/LaunchDaemons/com.mysql.plist

Some Rights Reserved