The default MySQL installer for OS X also includes a startup item that is added to the Mac System Properties thru which you start and stop MySQL. For development purposes, I needed to be able to tail the query log. According to the documentation, you can pass –log=path-to-log-file to the startup script, or add a log entry to the [mysqld] section of /etc/my.cnf file. The latter is the easiest way of creating a query log on OS X. Here are the steps that you need to follow:
- Create the file /etc/my.cnf (if you already don’t have one) and add the following lines:
[mysqld]
log=/var/log/mysqld.log - su (become root)
- cd /var/log
- touch mysqld.log
- chmod 777 /var/log/mysqld.log
- Restart MySQL
Now you should be able to tail -f /var/log/mysqld.log
December 27, 2008 at 1:56 am |
Thanks much! I was surprised that my.cnf was nonexistent all this time. A sql log is pretty helpful.
August 7, 2009 at 12:36 pm |
kool! nice tip! thanx