HomeRumblingsSoftwareTravelingArchivesAbout
mySQL on Snow Leopard

It was inevitable that rutema would one day have to use a different database than sqlite3.
To do that I needed a testbed therefore I chose mySQL.

This is a “forget-me-not” for the way to a local mySQL installation on Snow Leopard.
Instead of going with the prepackaged .dmg I chose to install mySQL using MacPorts. This was pretty straightforward and went without a hitch.

The mysql executables end up in /opt/local/bin, and they are all suffixed with a ‘5’. The actual binaries are all under /opt/local/lib/mysql5/ (no suffix there).

After compilation succeeds you need to do the following:

In order to setup privileges, you enter the mysql command shell as root(/opt/local/bin/mysql5 -u root -p) and setup your database and users. The rutema setup looks something like

create database rutema;

create user rutema;

grant all on rutema.* to rutema;

set password for rutema = password('pass');

The current activerecord gem does not include the pure ruby mysql code anymore and requires the C based mysql gem. This is a bit tricky to install as it needs to compile as 64 bit to work with the Apple standard Ruby installation.

sudo env ARCHFLAGS="-arch x86_64" gem install --no-rdoc --no-ri mysql -- --with-mysql-dir=/opt/local/lib/mysql5 --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config

should do the trick though.

blog comments powered by Disqus