Common SQL Errors

MySQL Error 1518: ER_NO_BINLOG_ERROR - How to Fix and Prevent

Galaxy Team
August 7, 2025

<p>The server blocks a command that tries to turn off binary logging, which is mandatory for replication and point-in-time recovery.</p>

Sign up for the latest in common SQL errors from the Galaxy Team!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

What is MySQL error code 1518?

<p>MySQL Error 1518: ER_NO_BINLOG_ERROR appears when a statement attempts to disable binary logging with sql_log_bin = 0 in an environment where logging is required. Re-run the command without suppressing the binlog or execute it on a session not involved in replication to resolve the problem.</p>

Error Highlights

Typical Error Message

It is not allowed to shut off binlog on this command

Error Type

Configuration Error

Language

MySQL

Symbol

ER_NO_BINLOG_ERROR

Error Code

1518

SQL State

HY000

Explanation

Table of Contents

What is MySQL Error 1518: ER_NO_BINLOG_ERROR?

The exact message reads: "It is not allowed to shut off binlog on this command". MySQL raises it when a statement is executed with binary logging disabled through sql_log_bin = 0 or the NO_LOG_BIN modifier while the operation must be recorded in the binary log.

Binary logging drives replication, PITR, and audit trails. Blocking the attempt protects data consistency across replicas and backups, so resolving the error quickly is critical for production clusters.

What Causes This Error?

MySQL detects that sql_log_bin is OFF for the current session or statement, yet the command being executed alters data that must be captured in the binary log. This mismatch triggers Error 1518 to enforce durability guarantees.

The error also surfaces when a user without the SUPER or SESSION_VARIABLES_ADMIN privilege tries to toggle sql_log_bin. Privilege checks ensure only trusted accounts can affect replication safety.

How to Fix MySQL Error 1518 ER_NO_BINLOG_ERROR

Re-issue the DML or DDL without disabling logging. Simply removing SET sql_log_bin = 0 or the SQL modifier NO_LOG_BIN allows the statement to execute and be written to the binary log.

If you must run non-logged maintenance, switch the server to read-only, stop replication, or direct the command to a standalone replica where binary logging can be safely disabled.

Common Scenarios and Solutions

Dump restores that include 'SET sql_log_bin = 0' fail on replication masters. Remove the line from the dump or import on a replica instead.

CREATE TABLE ... SELECT with NO_LOG_BIN is rejected. Drop the modifier or execute the statement on a staging server, then replicate via standard channels.

LOAD DATA INFILE with binlog disabled causes Error 1518. Use LOAD DATA ... LOCAL or keep logging on and rely on replica parallelism for speed.

Best Practices to Avoid This Error

Never disable binary logging on a primary node. Use session-level variables only on isolated replicas or maintenance windows. Grant SUPER carefully and audit changes to sql_log_bin.

Galaxy’s versioned SQL editor highlights session variables, making accidental SET sql_log_bin = 0 easy to spot during code review, preventing the error before deployment.

Related Errors and Solutions

Error 1238 (ER_BINLOG_FORMAT_MIXED) warns of unsafe statements under MIXED binlog format. Switch to ROW or avoid nondeterministic functions to fix it.

Error 1099 (ER_CANT_LOCK) occurs when FLUSH TABLES WITH READ LOCK fails during binlog rotation. Resolve lock contention or reduce long-running transactions.

Common Causes

Disabling sql_log_bin at Session Level

Running SET sql_log_bin = 0 before a data-changing statement forces MySQL to raise Error 1518 when logging is mandatory.

Using NO_LOG_BIN Modifier

Specifying NO_LOG_BIN on CREATE TABLE, INSERT SELECT, or LOAD DATA commands directly conflicts with the server’s replication rules.

Insufficient Privileges

Accounts lacking SUPER or SESSION_VARIABLES_ADMIN cannot change sql_log_bin, so any attempt results in Error 1518.

Related Errors

MySQL Error 1238: ER_BINLOG_FORMAT_MIXED

Triggered when an unsafe statement runs under MIXED binlog format. Fix by switching to ROW or rewriting the query.

MySQL Error 1592: ER_BINLOG_UNSAFE_STATEMENT

Occurs when a nondeterministic function is used with STATEMENT logging. Change to ROW or remove the function.

MySQL Error 1607: ER_BINLOG_PURGE_PROHIBITED

Raised when PURGE BINARY LOGS would break replication. Verify replica positions before purging.

FAQs

Can I safely disable sql_log_bin on a replica?

Yes, as long as the replica will not feed other replicas and you accept that its changes will not propagate further.

Does SET sql_log_bin = 0 require SUPER privilege?

From MySQL 8.0.26 onward, SESSION_VARIABLES_ADMIN is also accepted, but most deployments still grant SUPER for this action.

Why do my mysqldump files contain SET sql_log_bin = 0?

mysqldump adds it to speed up imports. Remove or comment the line when loading into a master to avoid Error 1518.

How does Galaxy help prevent binlog errors?

Galaxy’s code linting flags any statement that toggles sql_log_bin and prompts a review, reducing the chance of replication-breaking mistakes.

Start Querying with the Modern SQL Editor Today!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Check out some other errors

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo