MySQL issues warning 1867 when a PURGE BINARY LOGS or automatic log expiration tries to delete a binary log still being read by another thread.
MySQL Error 1867 (ER_WARN_PURGE_LOG_IN_USE) signals that the server could not delete a binary log file because a replication or client thread is still reading it; wait for the thread to finish or stop it, then rerun PURGE BINARY LOGS to resolve the warning.
ER_WARN_PURGE_LOG_IN_USE
Error 1867 appears as a warning when MySQL attempts to execute PURGE BINARY LOGS or expire logs automatically but finds that a target log file is still open by another thread.
Instead of stopping the purge process entirely, MySQL skips the busy file and continues, reporting the exact file name and thread count in the warning text.
The most common cause is an active replication slave or client that is reading the binary log at the moment the purge runs. The server will not delete a log being read to avoid breaking replication or client connections.
Long-running transactions or delayed replication can also keep old binary logs open for extended periods, blocking their removal.
Identify which thread is reading the file, let it finish or kill it, then rerun PURGE BINARY LOGS. If the reader is a slave, ensure it catches up or re-configure its replication position before retrying.
Once no threads are using the file, execute PURGE BINARY LOGS TO 'target_log'; again and the warning should disappear.
During scheduled log cleanup, a delayed slave may still tail the oldest log. Pause the purge, allow the slave to catch up, then resume.
In backup scripts that read binary logs while copying them, coordinate purge timing so backups finish first.
Monitor SHOW SLAVE STATUS and binlog file positions before purging. Automate checks that skip purge while slaves lag.
Use GROUP REPLICATION or GTID based setups with replica lag alerts, and set binlog_expire_logs_seconds high enough for normal lag.
Error 1592 (ER_BINLOG_PURGE_PROHIBITED) blocks purge entirely when GTID_PURGED would be invalidated. The fix is to wait until replicas have processed the GTID range or skip the GTIDs.
Error 1380 (HY000): You are not permitted to delete binary log files while replication or backups need them. Grant proper privileges or finish operations first.
A replica is reading the binary log, preventing its deletion.
A client keeps an old log open until the transaction commits or rolls back.
External tools such as mysqlbinlog are streaming the log for backups or auditing.
An intentional delay in replication keeps readers on older logs.
Raised when purging would remove GTIDs needed by replicas.
The replica cannot find the requested log file, often after an unsafe purge.
Attempt to delete or rotate an in-use binary log fails due to privilege or state issues.
No. It is a warning only. Replication continues and the server skips purging the busy log.
You can ignore it briefly, but left unchecked binary logs may grow until storage fills. Always ensure they are eventually purged.
Compare the file in the warning to Relay_Master_Log_File in SHOW SLAVE STATUS on each replica.
Galaxy's query history and AI copilot surface long-running queries that keep logs open, letting teams fix them before purge time.