error running shared postrotate script for mysql
I installed a new Ubuntu 18.04 server with mysql, and I receive the following error by email daily:
Cron <root@www> test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
/etc/cron.daily/logrotate:
error: error running shared postrotate script for '/var/log/mysql.log /var/log/mysql/*log '
run-parts: /etc/cron.daily/logrotate exited with return code 1
How can I fix this error?
Solution 1:
I think I found the problem according to https://serverfault.com/questions/325171/debian-mysql-error-running-shared-postrotate-script-for-var-log-mysql-log:
My password for user debian-sys-maint
was not correct. I updated the password with:
update user set authentication_string=password("<password>") where user="debian-sys-maint";
Solution 2:
For what it is worth, in my case this error resulted from the postrotate script being run before the startup of mysql was finished. By just delaying logrotate.timer or the cron job by e.g. 60 secs, the problem was solved.