1396
MariaDBerrorreplicationhigh confidence

Operation not allowed on slave

Production Risk

Low — write blocked; the protection is intentional.

What this means

A write operation (INSERT, UPDATE, DELETE, DDL) was attempted on a read-only replica server.

Why it happens
  1. 1read_only = ON on the replica
  2. 2super_read_only = ON on the replica (blocks even SUPER users)
  3. 3Application mistakenly targeting a replica instead of the primary
How to reproduce
trigger — this will error
trigger — this will error
INSERT INTO t (col) VALUES (1); -- on a replica with read_only=ON

expected output

ERROR 1396 (HY000): The MySQL server is running with the --read-only option so it cannot execute this statement

Fix 1

Direct writes to the primary

Why this works

Ensure the application connection string points to the primary/source server.

Fix 2

Temporarily disable read_only (DBA only)

Temporarily disable read_only (DBA only)
SET GLOBAL read_only = OFF;

Why this works

For emergency manual operations only; re-enable immediately after.

What not to do

Version notes

Sources
Official documentation ↗

MySQL 8.0 — 1290 / 1396 read_only enforcement

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MariaDB errors