<p>Error 1587 happens when MySQL hits the operating system file descriptor limit while purging binary logs, stopping the PURGE BINARY LOGS command.</p>
<p>MySQL Error 1587: ER_BINLOG_PURGE_EMFILE signals that the server ran out of file descriptors during PURGE BINARY LOGS. Raise open_files_limit or ulimit and rerun the purge to fix the issue.</p>
Too many files opened, please execute the command again
MySQL raises error 1587 with message "Too many files opened, please execute the command again" when it tries to delete binary log files but cannot open another file descriptor because the operating system limit has been exhausted.
This interruption stops the PURGE BINARY LOGS statement or the automatic expire_logs_days process, leaving old log files on disk and risking storage exhaustion.
The server must open each binary log file scheduled for deletion. If the total number of simultaneously open files - tables, indexes, sockets and logs - exceeds open_files_limit or the OS hard limit, MySQL cannot allocate another descriptor and throws error 1587.
Large log retention windows, many active connections or low system limits dramatically increase the chance of hitting the limit.
Increase the file descriptor cap, then rerun the purge. On Linux, set LimitNOFILE in the mysqld systemd unit or raise ulimit -n, restart MySQL, and verify with SHOW VARIABLES LIKE 'open_files_limit'.
After raising the limit, execute PURGE BINARY LOGS or allow expire_logs_days to run again to remove the backlog.
Automated log rotation fails during peak traffic: temporarily disable binary logging on replicas, raise limits, then resume rotation.
Disk nearly full because purge stopped: attach extra storage, bump limits, then purge logs to free space.
Set open_files_limit and OS ulimit -n to at least double the peak number of open tables plus expected binary logs.
Enable binlog_expire_logs_seconds to keep log count manageable and monitor descriptor usage via performance_schema.
Error 24 Too many open files - occurs at OS level when any process exceeds ulimit.
Error 1528 ER_CANNOT_PURGE - triggered when a log is still in use by replication; wait or stop the slave SQL thread.
MySQL open_files_limit value is smaller than workload demands, exhausting descriptors during log purge.
The operating system hard limit overrides MySQL settings, capping descriptors to a low number.
Thousands of retained logs push total open files above default limits when purge starts.
Processes that keep many tables open consume descriptors and starve maintenance operations.
OS-level failure that can also block client connections.
Raised when a binary log is still required by replication threads.
Occurs when MySQL cannot open relay log due to descriptor shortage.
Run SHOW VARIABLES LIKE 'open_files_limit' inside MySQL and ulimit -n in the shell where mysqld starts.
Raising open_files_limit at runtime works only up to the compiled ceiling; higher values need a restart with a larger OS limit.
Increasing the cap has negligible performance impact and prevents outages caused by descriptor exhaustion.
Galaxy highlights error 1587 in query history and suggests raising open_files_limit, allowing engineers to resolve the issue quickly from the editor.