After a fresh install of Debian Squeeze and mysql server, started to appear the following error as email from cron:
/usr/bin/mysqladmin: refresh failed; error: 'Unknown error'
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
After the installation of mysql-server package, the first time the mysql-server starts, the mysqld_safe creates an error logfile(/var/log/mysql/error.log) owned by root which prevents mysqladmin called by logrotate from flushing the log file, resulting in this error email from cron.
Well some developer has made some patch in the mysql_safe but only for mysql 5.5 which is not yet used in Debian Squeeze.
So a quick solution would be to re-own the log file to mysql with the following command.
Note dependent on your mysql-server configuration (/etc/mysql/my.cf) just make sure the path to this error log is adapted to your configuration:
chown mysql: /var/log/mysql/error.log
The problem will go away.
I think the best solution would be to patch the script mysql_safe, but so far I didn’t have time to get into this research.
If any of you has done the work, please contribute by adding your solution as comment here. Thanks