MySQL stops writing logs into /var/log/mysql/general.log file after its log rotation done by anacron.

Solution Verified - Updated -

Issue

MySQL stops writing logs into /var/log/mysql/general.log file after its log rotation done by anacron even though the log rotation itself finishes properly shown as follows.

[root@localhost ~]# ls -l /var/log/mysql/
-rw-r-----+ 1 mysql mysql        0 Dec 23 03:20 general.log
-rw-r-----+ 1 mysql mysql 29475919 Dec 23 03:20 general.log-20201223.gz

And, running logrotate command manually ends up failing with following errors.

[root@localhost ~]# logrotate /etc/logrotate.d/mysqld
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'
error: error running non-shared postrotate script for /var/log/mysql/general.log of '/var/log/mysql/general.log'

Environment

  • Red Hat Enterprise Linux 8
  • MySQL

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content