Running MySQL on OS X Leopard

I’ve recently gotten back into some development and needed to run MySQL on my Leopard computers. The easy way out was downloading and running MAMP (a great pre-built package of Apache and MySQL). Unfortunately, I hated starting the Apache and MySQL daemons manually.

I created OS X launchctl scripts to start Apache and MySQL but I hated the fact that I was maintaining two installations of Apache (the one that comes with OS X and the MAMP one). I wanted one simple installation of everything that would start automatically. Also, occasionally, weird things would happen with permissions and I’d have to shut everything down and restart again.

It’s been some time since I compiled my own software so I was looking forward to compiling MySQL from scratch. The first thing I found was this great post on Hivelogic about compiling MySQL. I’m not going to regurgitate what’s in the post but I’m going to highlight the configure flags for Leopard. Most times, when compiling applications, getting all the flags right is the only way to ensure your specific OS and architecture are properly supported in the compilation process and it’s the only way to squeeze out the best performance.


CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer" CXX=gcc \
CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors \
-fno-exceptions -fno-rtti" \
./configure --prefix=/usr/local/mysql \
--with-extra-charsets=complex --enable-thread-safe-client \
--enable-local-infile --enable-shared

Make sure you change your root (data base administrator password) by running:

/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h localhost password 'new-password'

Don’t forget to secure your server as indicated on HiveLogic.

My plist file for automatically launching MySQL under MAMP is here. Feel free to compare it to the post at HiveLogic or change it to suit your needs. If you have any suggestions on how to improve it, please let me know.


Posted

in

, , ,

by

Comments

One response to “Running MySQL on OS X Leopard”

  1. […] I opted to do it in Perl 5.10. You may remember a post that I put up in August describing how to compile MySQL 64 bit for OS X Leopard. Well, since then I also compiled and installed Perl 5.10 (not replacing Apple’s system […]