March 8, 2016

[SOLVED] "error running shared postrotate script for '/var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log '"

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.

mysql -u root -p

use mysql;
update user set password=PASSWORD("oMhAfEiEiO") where user="debian-sys-maint";


It seems like every time I reinstall the backup of my databases on a new system I overwrite the password.

No comments:

Post a Comment