Category Archives: MySQL

Cron Job : Logrotate MySQL Error

Receiving cron-daily emails with this error:

/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 /var/log/mysql/error.log '
run-parts: /etc/cron.daily/logrotate exited with return code 1

It was fixed by making sure the password in the /etc/mysql/debian.cnf is the same as the one in the MySQL database.

Try running this command:

GRANT RELOAD, SHUTDOWN, PROCESS, SHOW DATABASES, SUPER, LOCK TABLES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'XXXXXX';
FLUSH PRIVILEGES;

Replace XXXXXX with the password in the /etc/mysql/debian.cnf.