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:
- Find user that runs job in
/etc/logrotate.d/mysql-server
/etc/mysql/debian.cnf
- Record password for
debian-sys-maint
- Run query
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.
show grants for 'debian-sys-maint'@'localhost';
- Noticed the password was different from the one inside the file posted above
set password for 'debian-sys-maint'@'localhost' = PASSWORD('**********');