<p>MySQL throws error 1387 when you attempt to change a global server variable that binary logging or replication forbids from being modified online.</p>
<p>MySQL Error 1387: ER_LOGGING_PROHIBIT_CHANGING_OF occurs when you try to change certain global variables while binary logging or replication is active. Stop replication or disable binary logging for the session, change the variable, then re-enable logging to resolve the issue.</p>
Binary logging and replication forbid changing the global
The server raises this error when a client issues SET GLOBAL or similar statements that attempt to modify variables protected by binary logging or replication. MySQL blocks the change to keep replicas consistent and to avoid data loss.
The error message includes the name of the variable you tried to alter. Typical offenders are general_log, slow_query_log, read_only, and log_bin. The safeguard is hard-coded, so the command fails until the protection is lifted.
You see the error in primary-replica setups, GTID environments, or any server started with --log-bin. It often surfaces during maintenance windows when DBAs toggle logging flags or automate variable changes through scripts.
Developers sometimes meet it inside stored procedures that execute SET GLOBAL statements, because the server executes those statements in the replication stream and blocks them.
If your automation expects the variable change to succeed, the failure can halt deployments, leave verbose logging enabled, or disable important audit logs. Addressing the error keeps replication healthy and avoids performance hits from unintended logging states.
The root cause is a conflict between the requested variable change and binary logging rules. MySQL cannot safely replicate certain dynamic changes, so it refuses the operation to guarantee deterministic replay on replicas.
Another cause is issuing the change on the wrong scope. Some variables can be altered only at the session level when binary logging is enabled. Attempting a global change triggers the error.
First, assess whether you can momentarily stop replication threads. If yes, execute STOP SLAVE (or STOP REPLICA), apply the variable change, and restart replication. This keeps replicas in sync.
When downtime is impossible, disable binary logging for your session using SET sql_log_bin = 0, perform the change, then re-enable logging with SET sql_log_bin = 1. Always verify binlog format afterwards.
Plan variable changes during maintenance windows. Use configuration files for static settings and restart the server instead of changing protected variables online. Automate checks that refuse to run SET GLOBAL statements on protected variables when --log-bin is active.
Leverage a developer-centric SQL editor like Galaxy, which surfaces variable scope, alerts you before unsafe changes, and lets you run session-scoped commands with a single shortcut.
The general_log variable is replicated, and altering it with SET GLOBAL general_log = 1 fails when log-bin is on.
MySQL blocks global changes to slow_query_log because replicas might diverge in logging states.
The read_only flag influences statement execution order; replication forbids altering it while SQL threads run.
Turning off binary logging online endangers replication integrity, so MySQL rejects the request.
Raised when logging cannot be started or stopped due to file or permission issues.
Appears when you reference a variable that does not exist or is misspelled.
Occurs when the account lacks SUPER or SYSTEM_VARIABLES_ADMIN privileges needed to run SET GLOBAL.
Yes. Run SET SESSION sql_log_bin = 0, change general_log at the global scope, then set sql_log_bin back to 1. Verify replicas stay consistent.
No. It exists from MySQL 5.0 through 8.1 because the underlying replication safety check remains unchanged.
Yes. Static configuration changes applied at startup do not conflict with binary logging rules.
Galaxy flags protected variables in its AI copilot, warns before executing unsafe SET GLOBAL commands, and offers one-click session-scoped execution to bypass the error.