stocksy.co.uk
"the site for those who crave disappointment"

Sponsored Links

MySQL 5 on OS X 10.5.x Leopard

24th Apr 2008, 19:36:17

By James Stocks

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

2 Archived Comments

17th Apr 2009, 17:55:01 by printelectric
James,

First off, thanks a ton for your effort on this. So far it\'s the best I\'ve found for what I\'m about at the moment. Having said that, there was one thing missing for me that would have helped. In order to get this working on my MacBook Pro with Leopard (10.5.6), I needed to do \'sudo chown -R mysql:mysql /usr/local/mysql\' after the installation, but before I was allowed to proceed with installing default databases, etc. Hopefully this comment will save some other poor noob like me a few minutes (hours?) of head scratching. Well, I\'m off to try your PHP install now. Thanks again - overall this has been a lifesaver.

18th Apr 2009, 08:45:37 by stocksy
Glad this helped.

It\'s weird that you had this problem because the MySQL installer is supposed to set all these permissions for you. You probably only needed to give MySQL write permissions to /usr/local/mysql/data:

$ sudo chown -R mysql /usr/local/mysql/data
$ sudo chmod u+rw /usr/local/mysql/data

But if it works, great - it\'s not important in a non-production environment!

Also, you\'re the first \'real\' commenter on my site - I suppose I should fix that double-escaping of quotes!

New Comments

Some Rights Reserved