Updated: 16 November 2026 · Applies to: logrotate 3.22 on AlmaLinux 10 and Debian 13; MySQL and MariaDB servers

The error duplicate log entry for /var/lib/mysql/mysqld.log means two logrotate configuration files both claim the same log file. logrotate refuses the second one, skips that whole file and exits with an error. To fix it, find the two files that mention the log, keep one, and move the other out of /etc/logrotate.d/.

This often happens after a MySQL or MariaDB upgrade or a switch between the two: the new package installs its own logrotate file (for example /etc/logrotate.d/mysql) while the old one (for example /etc/logrotate.d/mysqld) stays behind.

What the error looks like

When we placed two files for the same log on an AlmaLinux 10 test server, a test run printed:

reading config file mysqld
error: mysqld:1 duplicate log entry for /var/lib/mysql/mysqld.log
error: found error in file mysqld, skipping

The part before the colon (mysqld:1) is the file name inside /etc/logrotate.d/ and the line number where the duplicate starts. logrotate also exits with code 1, so the daily logrotate job is reported as failed and cron or systemd may email root about it.

How to fix it

  1. Find every logrotate file that mentions the log:
    grep -rl "mysqld.log" /etc/logrotate.conf /etc/logrotate.d/
    Output from our test:
    /etc/logrotate.d/mysql
    /etc/logrotate.d/mysqld
  2. Compare the two and decide which one to keep. Keep the one that belongs to the database package you actually run, and check that its postrotate section calls a command that exists on your server (for example mariadb-admin or mysqladmin).
    cat /etc/logrotate.d/mysql /etc/logrotate.d/mysqld
  3. Move the other file out of the folder rather than deleting it, so you can put it back if needed:
    mv /etc/logrotate.d/mysqld /root/logrotate-mysqld.bak
    If you prefer to keep it in place, rename it with an ending logrotate ignores, such as .disabled or .old (in our test both were skipped). A copy with any other ending, for example mysqld-copy, is still read and still causes the error.
  4. Run logrotate in debug mode. It only prints what it would do and changes nothing:
    logrotate -d /etc/logrotate.conf
    The output should no longer contain duplicate log entry.
  5. Check the exit code of a debug run. 0 means the configuration is clean:
    logrotate -d /etc/logrotate.conf >/dev/null 2>&1; echo $?

Other ways to get the same error

  • A wildcard that overlaps a named file. A line such as /var/lib/mysql/*.log in one file also matches mysqld.log, so a second file naming /var/lib/mysql/mysqld.log causes the same error. In our Debian 13 test, logrotate reported the duplicate in both files. Make the wildcard narrower, or remove the named entry and let the wildcard cover it.
  • The same path twice in one file. Search inside a single file the same way with grep -n "mysqld.log" FILE.
  • A backup copy left in the folder. logrotate skips files ending in .bak, .old, .disabled, .rpmnew, .rpmsave, .dpkg-old, ~ and a few others, but a copy named, say, mysql-2 or mysql.save is loaded like any other file. Move such copies out as in step 3.

Where MySQL and MariaDB keep their log

The path in the error depends on how the server was set up. /var/lib/mysql/mysqld.log is a common error log location on older or panel-managed servers. The MariaDB package on AlmaLinux 10 ships its own file, /etc/logrotate.d/mariadb, which rotates /var/log/mariadb/mariadb.log. To see where your server writes its error log, ask the database:

mysql -e "SELECT @@log_error;"

Then make sure exactly one logrotate file covers that path. For a full guide to writing logrotate rules, see How to Set Up and Manage Log Rotation with logrotate; to rotate the slow query log separately, see How to separate MySQL Slow Log Using Logrotate in Ubuntu.

Official documentation: logrotate manual page.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Managed dedicated servers

our engineers look after the server for you, from $135 a month.

Was this answer helpful?

Still stuck? Open a ticket