mysql-community-server logrotate bug

After activating logrotate on my openSUSE LEAP 42.3 system with


# systemctl enable logrotate.service
# systemctl start logrotate.service

the journal displayed the error:

Mai 27 20:22:55 xenon logrotate[30522]: [61B blob data]
Mai 27 20:22:55 xenon logrotate[30522]: error: 'Access denied for user 'root'@'localhost' (using password: NO)'
Mai 27 20:22:55 xenon logrotate[30522]: /etc/logrotate.d/mysql failed, probably because
Mai 27 20:22:55 xenon logrotate[30522]: the root acount is protected by password.
Mai 27 20:22:55 xenon logrotate[30522]: See comments in /etc/logrotate.d/mysql on how to fix this
Mai 27 20:22:55 xenon logrotate[30522]: error: error running non-shared postrotate script for /var/log/mysql/mysqld.log of '/var/log/mysql/mysqld.log '

First problem:
The “See comments” line is wrong. The file /etc/logrotate.d/mysql does not exist. The correct file name is /etc/logrotate.d/mysql-community-server.

Second problem:
The fix proposed by the comments in /etc/logrotate.d/mysql-community-server does not work, or more precisely, it is not enough.
After creating the file /root/.my.cnf as proposed, the command “/usr/bin/mysqladmin ping” which logrotate wants to run in its postrotate script works fine when run as root.
However /etc/logrotate.d/mysql-community-server contains the directive “su mysql mysql” which causes the postrotate script to run as user mysql.

I fixed that by commenting out the “su mysql mysql” line but I wonder if that is the correct fix.

This should be reported in bugzilla where it has some chance to be fixed.

Done.

(Adding some text to avoid the “The message you have entered is too short. Please lengthen your message to at least 10 characters.” error from the forum. I might also add that this is a very silly restriction.)

It had been better if you simply added link to your bug instead of rant. This way people directed to your post by search would have something to continue with.