Cory O'Daniel – These are just words Software development, thoughts, and randomness

11Feb/100

Installing MySQL on Mac OSX w/ Ports

So, I originally installed MySQL on my new MacBook using the DMG as was alluded to in a previous post..

I rebooted my laptop the other day and for some reason all of my tables (InnoDB) where corrupted... I couldn't get them to repair. All the *.frm files were present. Even when I did a 'show tables' they would show up, but whenever I issued any DML mysql responded saying the table did not exist.

So I decided to wipe out my MySQL install, because it just seemed funky. I decided to go the ports route, and I'm so used to the doing the bastardized old way of installing it

1
sudo port install mysql5 +server +devel

Then proceeding to do about 5000 things to get it to start at boot time and have a *.sock file in the right place.

Then I came across this post while looking for a LaunchD file for MySQL. A comment by Mike Richards points out that there is a hip new (working) way of installing mysql with ports:

The mysql5 +server package variant in MacPorts is obsolete, and is superseded by the mysql5-server package, which you install in addition to mysql5. This allows you to build it after the fact, instead of re-compiling the entire mysql5 package with +server.

I'd suggest to just remove your old mysql5 +server, and install using the following.

sudo port install mysql5-server
That'll build both the required mysql5 and mysql5-server packages for you, and you'll have the mysql5 plist file in /Library/LaunchDaemons. Also note that you no longer need to symlink your mysqld.sock to /tmp/mysql.sock.

Thanks Mike!

1
sudo port install mysql5-server

And who would of thunk it? It 'just works' (as a side note, the binary name is mysql5 incase you don't think it works when you type 'mysql').

Make sure you read all the output from Port. You'll need to load the LaunchD file in launchctl and either manually start MySQL the first time or just reboot and have OSX do it for you.

Yay. I can do some work now.

Post to Twitter Post to Digg Post to Facebook Post to Reddit Post to StumbleUpon

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.