msgbartop
MAC OS X, Linux, Windows and other IT Tips and Tricks
msgbarbottom

17 Jan 13 logrotate /usr/bin/mysqladmin: refresh failed; error: ‘Unknown error’

Problem:
After a fresh install of Debian Squeeze and mysql server, started to appear the following error as email from cron:

/etc/cron.daily/logrotate:
/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

Cause:
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.

Solution:
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.

Note:
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

Reader's Comments

  1.    

    thanks, i resolve this problem with your tips

    Reply to this comment
  2.    

    thank you Michel, it solve a tiny problem that I had with oberon….

    Reply to this comment
  3.    

    thank you very much

    Reply to this comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: