[CentOS] CentOS 8.2: error running non-shared postrotate script for /var/log/mysql/mysqld.log

Sat Dec 5 14:35:10 UTC 2020
Alexander Farber <alexander.farber at gmail.com>

Hello fellow CentOS users!

I have installed CentOS 8.2.2004 with the following packages:

mysql-common-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64
mysql-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64
mysql-errmsg-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64
mysql-server-8.0.21-1.module_el8.2.0+493+63b41e36.x86_64

Then I have run mysql_secure_installation and among other things set the
root password for MySQL

As result I am greeted with the following anachron mail every morning:

/etc/cron.daily/logrotate:

 mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
error: error running non-shared postrotate script for
/var/log/mysql/mysqld.log of '/var/log/mysql/mysqld.log '

I understand that the reason is me having set the root password for MySQL.

But my question is how to provide the password to postrotate without
disclosing it too much?

Other than that the MySQL works well, I use it to host 3 Wordpress websites
at my CentOS 8 Linux server (haproxy -> Jetty x 3 -> FastCGI -> php-fpm ->
Wordpress -> MySQL)

Greetings from Germany
Alex