HOWTO enable the query log on MySQL on Mac OS X

Tailing the MySQL query log in real time can be a lifesaver for any developer, and it’s pretty easy to do:

Make a file for the mysqld process to write to:

sudo touch /var/log/mysql-query.log
sudo chown _mysql /var/log/mysql-query.log

If you’ve installed MySQL 5.1.x from the Mac .pkg, you won’t have an /etc/my.cnf, but it just needs to have these two lines:

[mysqld]
log=/var/log/mysql-query.log

Restart MySQL by opening the MySQL preference pane, click stop, then start, then tail -f /var/log/mysql-query.log. It turns out that when the preference pane is open, it pings the database every 2 seconds, so it can detect if the db is alive. If you mangle the my.cnf, you’ll find the start button seems to not respond to clicks.

(I found this link only after I found out what I needed to do…)

Installing Phusion Passenger on Ruby 1.9.1, Nginx, & Ubuntu 10.04

I wrote this a while back, before I knew about RVM. The Ruby Version Manager has a bunch of features that makes it better than macports for ruby and gem installation. Read about it here.

Getting ruby 1.9.1 and nginx and passenger and ubuntu to all play nicely is fairly straightforward, but it’s not just “apt-get” and “gem install” lovin’.

Making ruby 1.9.1 the default ruby is OK. Follow these steps:

Continue reading