How to fix logrotate cron job error (/etc/cron.daily/logrotate)

After migrating my database to a new server running Ubuntu 14.04.4 LTS i received an email with the following content:

Subject

Cron test -x /usr/sbin/anacron || ( cd / && run-parts –report /etc/cron.daily )

Body

/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

The reason why i was getting this error was because i imported my old mysql tables, including the users.
This particular cron job uses a mysql user debian-sys-maint to flush the logs, but i changed the password by importing all of my old tables.

You can fix this by creating the user with the correct password which can be found in the /etc/mysql/debian.cnf file:
Continue reading