MariaDB Log Rotate Errors

Every night, I get an email from my server with the following:

/etc/cron.daily/logrotate:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
error: error running shared postrotate script for '/var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mariadb-slow.log '
run-parts: /etc/cron.daily/logrotate exited with return code 1

I don't know why this is happening, and I can't figure out how to stop the error.


Solution 1:

There is linux utility logrotate, It is trying to rotate logs of mariadb.

You should look in file:

/etc/logrotate.conf

Look for section which has scripts(which sends you mails), Headed by:

/var/log/mysql.log {
...
...
...
} 
/var/log/mysql/mysql.log {
...
...
...
}
/var/log/mysql/mariadb-slow.log {
...
...
...
}

Maybe because credentials are not being entered. Either remove these scripts(hash them) if not wanted, Or give login credentials to MariaDB.

Hope it helps!