My Solution to “error running shared postrotate script for ‘/var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log ‘”

Thursday, April 7th, 2011 by

Recently I upgraded Linux on my home server and every day I would get this email:

Subject: Anacron job 'cron.daily' on server.local

/etc/cron.daily/logrotate:
error: error running shared postrotate script for '/var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log '
run-parts: /etc/cron.daily/logrotate exited with return code 1

I first examined the /etc/cron.daily/logrotate script.
There was only one executable line: /usr/sbin/logrotate /etc/logrotate.conf

I next examined /etc/logrotate.conf and found this: include /etc/logrotate.d

logrotate.d is a directory of scripts to run.

SInce my error message was for MySQL, I examined the /etc/logrorate.d/mysql-server script.
One line in this script is
MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"

I examined /etc/mysql/debian.cnf and found the cause of the error message:

user = debian-sys-maint
password = oMhAfEiEiO

It was the PASSWORD! There was a mismatch between the password in debian.cnf and the password for the debian-sys-maint user in MySQL.

Finally, I changed the password for debian-sys-maint in MySQL to the password listed in debian.cnf and the daily error message email stopped.

One Response to “My Solution to “error running shared postrotate script for ‘/var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log ‘””

  1. Anonymous says:

    The recommendations you discussed here are really useful. It absolutely was such a fun surprise to have that awaiting me after i woke up to find this event. Thank you very much for the tip!