Skip to content

Launchd Item for Mysql

I had to reinstall Mysql because it wasn’t one of the things I backed up before erasing my hard drive. Since I’m now running Mac OS X 10.4 “Tiger”, I decided to set it up to start when the system boots, but the system for creating startup items has changed slightly. So I saved the following xml in `/Library/LaunchDaemons/com.mysql.Mysql.plist`:

<?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC 
         "-//Apple Computer//DTD PLIST 1.0//EN" "
        http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
	<key>Label</key>
	<string>com.mysql.Mysql</string>
	<key>OnDemand</key>
	<false/>
	<key>ProgramArguments</key>
	<array>
		<string>/usr/local/mysql/bin/mysqld_safe</string>
	</array>
	<key>ServiceDescription</key>
	<string>Mysql 4.1 Database Server</string>
	<key>UserName</key>
	<string>root</string>
	<key>WorkingDirectory</key>
	<string>/usr/local/mysql</string>
    </dict>
    </plist>

This works for me, though I haven’t figured out how to change this .plist file so that I can __stop__ mysql yet… you’ll have to use `mysqladmin shutdown` for that, and honestly, I think the system will start it right back up anyway.

([MacGeekery][mac] was invaluable in helping me understand how to write this plist; thanks for the launchd tutorial!)

And here’s my reason for wanting to reinstall MySQL in the first place: [Installing Rails On a Fresh Tiger][tiger]

[mac]: http://www.macgeekery.com/tips/all_about_launchd_items_and_how_to_make_one_yourself
[tiger]: http://jamie.blogthing.com/2005/05/12/installing-rails-on-a-fresh-tiger/

One Trackback/Pingback

  1. tonyarnold.com on 11-Aug-05 at 12:36 pm

    MySQL Bindings for Ruby under Mac OS X Tiger

    … Basically, there are a few issues with the building of native gems under Mac OS X at the moment, and until they?re dealt with up-stream, getting certain rubygems to install is going to be trial and error… Here’s how you can do it.

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*