Cron MySQL Error

After completing the setup of my new VM, I was getting the following error daily and decided to try and fix it.

The error:
/etc/cron.daily/logrotate:
[MM/DD/YYYY hh:MM:SS] [warn] NameVirtualHost ***.***.***.***:** has no VirtualHosts
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

I googled ubuntu error: error running shared postrotate script for and tried the fix explained on this website (first result).

Basic steps listed on the website:

  1. Find user that runs job in /etc/logrotate.d/mysql-server /etc/mysql/debian.cnf
    1. Record password for debian-sys-maint
  2. Run query
    1. GRANT RELOAD, SHUTDOWN, PROCESS, SHOW DATABASES, SUPER, LOCK TABLES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY PASSWORD 'xxxxxxxxxxxxxxxx';

I hope this fixes the problem.

Edit #1: Posted the wrong file.

Edit #2: Didn’t work. Did some digging around MySQL and found the password might be incorrect. I did the following and will post back if I continue to get the error.

  1. show grants for 'debian-sys-maint'@'localhost';
    1. Noticed the password was different from the one inside the file posted above
  2. set password for 'debian-sys-maint'@'localhost' = PASSWORD('**********');

Leave a Reply

Your email address will not be published.