/etc/mysql/debian-log-rotate.conf: No such file or directory

As part of starting some Rails development on my linux dev box, I installed mysql-server which was up and running fine.  However, once a day I was getting an email from cron about a failure:

/etc/cron.daily/mysql-server: line 26: /etc/mysql/debian-log-rotate.conf: No such file or directory
run-parts: /etc/cron.daily/mysql-server exited with return code 1

So, apparently the daily cron script for mysql to do log rotation needs a fail /etc/mysql/debian-log-rotate.conf to exist.  If that’s true, it seems like it should have come in one of the packages, so I check to see what package should have installed it:

% dpkg -S debian-log-rotate.conf
dpkg: *debian-log-rotate.conf* not found.

So, none of my packages own a file by that name, in /etc/mysql or anywhere else.  So, it’s a bug that the file is needed but not present.  Whatever, this is 6.06 so I’m not going to bother reporting it since I’m pretty sure this is fixed more recently in the 3 released versions since.

What to do?  Well, let’s check out that script (/etc/cron.daily/mysql-server) around line 26 to see what it’s trying to do:

# Read config and see if we should rotate at all.
. /etc/mysql/debian-log-rotate.conf
if [ “$KEEP_BINARY_LOGS” -eq 0 ]; then
  my_exit 0

Since this is just a server to play around with and not a production system, I don’t care about keeping any logs around (I can re-create the schema, sans data, at any time with “rake db:reset:all“)

sudo vim /etc/mysql/debian-log-rotate.conf

I insert a single line of


And that’s it – now the script will exit early, but succeed fine.  And I won’t get any more cron emails about this particular failure 🙂