Installing MySQL on Leopard

Posted by John
on Friday, 14 December 2007

Yorkshire Sunset

Bit complex, but here's how...

Downloads

  • download the x86 package from link

  • grab CocoaMySQL to act as the GUI link

Terminal Work

Now the hard bit...

Open the mysql .dmg and install & run the mysql package (the startup one won't work, or the preference pane addon, so skip those).

So far you can only startup MySQL from the Terminal, so open a Terminal window...

sudo /usr/local/mysql/bin/safe_mysqld

Now open another Terminal window and do...

sudo mkdir /var/mysql/

Creating a symbolic link to your ports file, by running...

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

All done...

Start with...

Now you can start MySQL by running...

sudo /usr/local/mysql/bin/safe_mysqld

When you need to,

CocoaMySQL Settings

When opening CocoaMySQL, specify your settings as...

host = localhost
user = root
password = blank

Funky Autostarts with Launchctl

To handle Startup jobs, like cron, OSX and Leopard come with a new tool called Lauchctl which makes setting up startup tasks better.

First off you'll need this config file...

<?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.mysqld</string>
    <key>Program</key>
    <string>/usr/local/mysql/bin/mysqld_safe</string>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>

Save this into a text file, but give it the name & extension...

com.mysql.mysqld.plist

Now drag / copy it into your HardDrive's /Library/LaunchDaemons folder

Now you need to set it's owner as root, so in Terminal run...

sudo chown root /Library/LaunchDaemons/com.mysql.mysqld.plist

Now make it autoload by running...

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

Job done, next time you boot your MacBook running Leopard it'll autostart MySQL Server.

Thanks to...

Leave a response Comments
  1. http://parkablogs.blogspot.comSaturday, 26 January 2008
    This works very well. Thanks a lot.
Feedback
(required)