OSX Leopard Mysql Log Rotation
For a development machine, it is sometimes nice to log all mysql queries.
with Mysql, you turn on logging by placing this entry in your my.cnf
[mysqld] log = /var/log/mysql/mysql.log
In doing that though, the log file can get quite large pretty quickly. I started googleing around for a solution, and found this link to be quite helpful though it didn’t mention mysql logs specifically.
On Leopard, the file that controls log rotation is /etc/newsyslog.conf
The entry I use looks like this.
# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num] /var/log/mysql/mysql.log mysql:wheel 644 10 1000 * JS /usr/local/mysql/data/si-sam.local.pid 30
This rotates mysql.log anytime it grows beyond 1000k and keeps 10 compressed archives on hand
For your machine the actual logfile location can differ and the location and name of the pid file will most certainly be different.
To track down the name and location of your mysql pid file, execute
$ps aux | grep mysqld
and look for the —pid-file=
--pid-file=/usr/local/mysql/data/si-sam.local.pid


Comments (0)
Add a Comment