How to Fix MySQL Error 1381 (ER_NO_BINARY_LOGGING)

Published
Length
3 min read

Luis Felipe Dias

All posts

You see mysql error 1381 when a query needs the binary log, which is off. You fix it by turning on binary logging in your server settings and restarting. The official symbol for this failure is ER_NO_BINARY_LOGGING, and it uses SQLSTATE HY000. The server returns the plain message that you are not using binary logging. This stops tasks like replication, point-in-time recovery, and log checks right away. Why mysql error 1381 happens in your database MySQL uses binary logs to record every chang

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You see mysql error 1381 when a query needs the binary log, which is off. You fix it by turning on binary logging in your server settings and restarting.

The official symbol for this failure is ER_NO_BINARY_LOGGING, and it uses SQLSTATE HY000. The server returns the plain message that you are not using binary logging. This stops tasks like replication, point-in-time recovery, and log checks right away.

Why mysql error 1381 happens in your database

MySQL uses binary logs to record every change made to your data and tables. Many admin tasks read or purge these log files during daily work. If the engine runs without this log feature, those admin commands fail at once.

A common cause is running a log check or purge on a standalone server. Dev and test servers often skip binary logs to save disk space and speed. When an engineer runs a replication command there, the database throws mysql error 1381.

This issue also happens after a server upgrade or a change to startup files. If a team member edits the main setup file and removes the log setting, logging stops. The next restart brings the database up without binary logs, breaking downstream tools.

Backup scripts are another frequent trigger for this specific database error. Many backup tools ask the server to flush logs or mark the current log position. Without active binary logs, the backup job fails and alerts the operations team.

How to check the server state safely

Before you change any server rules, check if the database actually needs binary logs. Log in with a read-only role and check the current server status variables. You can see right away if the binary log feature is on or off.

Next, check which app, user, or script sent the failing query to the server. Sometimes a monitoring agent runs replication checks on a node that never replicates data. In that case, you should fix the monitoring tool instead of changing the database.

MySQL Access Governance + K8s Audit Logging: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Avoid giving broad admin rights to developers just so they can debug this error. High-level roles let users change runtime states that might hurt production stability. Keep diagnostic permissions tight so engineers can read server state without changing global rules.

How to fix the error and restore logging

If your server needs binary logs for backups or replicas, update the server setup file. Add the setting that turns on binary logging and sets a safe file path. Make sure the storage disk has plenty of free space for new log files.

You should also set a clear rule for how long the server keeps old logs. Without an expiration rule, binary logs will fill up your disk and crash the host. Pick a retention window that matches your team's backup schedule and recovery goals.

Enabling the binary log requires a full restart of the MySQL server process. Plan this restart during a quiet maintenance window to avoid dropping active app traffic. Once the server comes back online, run a quick check to confirm logging works.

If the server is a test node that does not need logs, take another path. Update your backup script or admin tool so it skips binary log commands. This clears the error without adding extra disk load to your test system.

Check MySQL queries and results on the wire

MySQL grants control who logs in. They do not check single queries or mask sensitive columns once a session starts. With hoop.dev, you run an open-source proxy, a sidecar for your MySQL, inline in the MySQL wire protocol. On every query an AI agent or human runs against production MySQL, RDS, or Aurora, hoop.dev decides to pass, mask, block, or hold it for review.

Multi-statement batches and prepared queries are split and checked one by one by hoop.dev guardrails, which refuse banned queries with a native MySQL error or hold risky ones for approval. On the response path, hoop.dev data masking rewrites string values in returned rows in memory, and every decision is logged. See the MIT-licensed project on GitHub.

Frequently asked questions

What does ER_NO_BINARY_LOGGING mean in MySQL?

ER_NO_BINARY_LOGGING is the system symbol for error 1381 under SQLSTATE HY000. It means a user ran a binary log command while binary logging was off.

Can I turn on binary logging without restarting the database?

No, MySQL requires a server restart to turn on the core binary log feature. You must update the startup setup file and restart the service during a planned window.

Does turning on binary logs slow down database writes?

Writing to the binary log adds a small amount of disk work for each change. For most production apps, the safety of point-in-time recovery is well worth this small cost.

The query runs. The emails stay hidden.