MySQL raises error 1186 when RESET MASTER is issued after the binary log has been closed with FLUSH LOGS or FLUSH BINARY LOGS.
MySQL Error 1186: ER_FLUSH_MASTER_BINLOG_CLOSED occurs when you run RESET MASTER after the binary log is closed. Re-enable binary logging with SET sql_log_bin = 1 or restart MySQL with --log-bin, then re-run RESET MASTER.
ER_FLUSH_MASTER_BINLOG_CLOSED
ERROR 1186 (HY000): Binlog closed, cannot RESET MASTER
The server refuses to execute RESET MASTER because binary logging is currently disabled.
Resetting requires an open active binary log so that the command can safely purge existing files and create a new one.
The condition name ER_FLUSH_MASTER_BINLOG_CLOSED is triggered mainly after FLUSH LOGS, FLUSH BINARY LOGS, or manual log-bin toggling has closed the current binary log file.
Issuing RESET MASTER when the global variable log_bin is OFF causes MySQL to throw error 1186.
The most common path is running FLUSH LOGS; SET GLOBAL sql_log_bin = 0; or starting mysqld without the --log-bin option.
Replication cleanup scripts that flush logs before resetting can also hit this race condition if binary logging is not re-enabled between the two commands.
First, reopen the binary log. Set sql_log_bin = 1 for the current session, or restart MySQL with log-bin enabled in my.cnf.
After confirming SHOW VARIABLES LIKE 'log_bin' returns ON, run RESET MASTER again.
If you only need to delete old files, use PURGE BINARY LOGS TO 'binlog.000123' instead; it works even when logging is off.
Scheduled maintenance scripts that rotate logs may disable logging for bulk data loads. Ensure the script turns logging back on before issuing RESET MASTER.
On replicas promoted to standalone servers, log-bin may be turned off.
Enable it to reset or use PURGE BINARY LOGS for cleanup.
Always check log_bin status before calling RESET MASTER. Automate the check with IF clause logic. Avoid disabling binary logging on production masters.
Keep log-bin set permanently in my.cnf to survive restarts. Use PURGE BINARY LOGS for routine cleanup instead of RESET MASTER.
ERROR 1534 (HY000): Currently executing BINLOG statements can conflict with RESET MASTER; wait for them to finish.
ERROR 1558 (HY000): Cannot purge log when replication threads are running.
These issues are solved by stopping replication threads or waiting for ongoing BINLOG operations to complete.
.
Yes. It removes every existing binlog file and starts a new sequence at mysql-bin.000001, so use it carefully on production.
RESET MASTER is safe on replicas if replication is stopped and the instance will not serve as a source until new coordinates are shared.
Yes. Purging lets you keep recent logs while deleting older ones needed for point-in-time recovery.
Galaxy’s SQL editor surfaces server variables inline, so you can verify log_bin status before running administrative commands and share vetted scripts with your team.