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…)
Related posts:
- Apache2, PHP, and MySQL on Mac OS X using MacPorts
1. Install MacPorts Follow the instructions here: http://www.macports.org/install.php. 2. Install apache2 sudo port install apache2 Note that the macports instructions suggest installing the launchctl script now, but we’ll do that...... - Set up JAVA_HOME to track Java Preferences.app on Mac OS X
Mac OS X’s Java Preferences.app has a pane for switching between versions of the JDK, but I just found out from a coworker (thanks, Mike!) that you can make your...... - Make OpenOffice the default “.doc” and “.xls” application on Mac OS X
OpenOffice 3.0 is now out for the Mac. Finder opens files that end in “.doc” with TextEdit by default, and “Open with…” doesn’t seem to stick. What to do? In...... - Faster MySQL dumps and loads with –tab and –use-threads
By default, mysqldump writes a series of sql DDL and inserts to standard out, that you can then pipe to another database server to recreate a given database. The problem......