Common SQL Errors

MySQL Error 1874 ER_INNODB_READ_ONLY: InnoDB is in read only mode - How to Fix and Prevent

Galaxy Team
August 8, 2025

The InnoDB engine is running in read only mode so any statement that modifies data fails.

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 1874 ER_INNODB_READ_ONLY?

ER_INNODB_READ_ONLY means MySQL started with the InnoDB engine locked in read only mode, so inserts, updates, and deletes are blocked. Remove the --innodb-read-only flag, fix file-system permissions, or switch the instance back to read write and the error disappears.

Error Highlights

Typical Error Message

ER_INNODB_READ_ONLY

Error Type

Storage Engine Error

Language

MySQL

Symbol

ER_INNODB_READ_ONLY was added in 5.7.2.

Error Code

1874

SQL State

HY000

Explanation

Table of Contents

What is MySQL error ER_INNODB_READ_ONLY?

MySQL raises ER_INNODB_READ_ONLY (error code 1874, SQLSTATE HY000) when the InnoDB storage engine has been started in read only mode. While active, the server allows only SELECT and administrative statements that do not modify data.

The condition is usually intentional - for example, a MySQL replica mounted on read only storage - but it can also appear after a crash, a permission change, or a misconfigured startup flag.

When does the error occur?

The message surfaces at runtime whenever an application issues INSERT, UPDATE, DELETE, CREATE, DROP, or any DDL/DML that needs write access to an InnoDB table. The server immediately aborts the statement and returns error 1874.

Why is it important to fix?

Read only mode prevents schema migrations, data ingestion, and routine updates. If the state is accidental, restoring write capability is critical to resume normal operation, avoid data drift, and keep applications online.

What Causes This Error?

Most frequently the server was started with the --innodb-read-only flag or with super_read_only enabled. A disk mounted as read only or a file-system permission change can also push InnoDB into this mode. Crash recovery that detects corrupt redo logs may fall back to read only until manual intervention.

How to Fix ER_INNODB_READ_ONLY

Confirm the mode with SHOW VARIABLES LIKE 'innodb_read_only'. If ON, restart mysqld without the flag or set GLOBAL innodb_read_only = OFF when permitted. Ensure the underlying file-system is mounted rw and MySQL has write permissions on the datadir. If super_read_only is active, disable it with SET GLOBAL super_read_only = OFF.

Common Scenarios and Solutions

A replica server traditionally runs with read_only but not innodb_read_only. Ensure you are using the correct variable. On Kubernetes, a persistent volume may mount read only after a node restart; remount it rw and recreate the pod. After crash recovery, inspect the error log, run innodb_force_recovery correctly, then return to normal mode.

Best Practices to Avoid This Error

Automate startup scripts so innodb_read_only is never set in production unless needed. Monitor SHOW GLOBAL VARIABLES regularly and alert when innodb_read_only or super_read_only flip to ON. Keep consistent file-system permissions and ensure backups do not overwrite them. Test failover procedures so mounts come back read write.

Related Errors and Solutions

Error 1290 - The MySQL server is running with the --read-only option: occurs at the global server level rather than engine level. Disable read_only or adjust super_read_only accordingly. Error 1036 - Table is read only: usually points to file-system permissions on a single table.

Common Causes

mysqld started with --innodb-read-only

The server was explicitly launched in read only mode, often by automation or a mistaken flag.

super_read_only or read_only variables enabled

Global read only settings override normal privileges and propagate to InnoDB.

File-system mounted read only

The operating system mounted the volume as read only after an I/O error or manual action, blocking writes from InnoDB.

Incorrect datadir permissions

MySQL lacks write permission on the data directory or redo log files, so the engine switches to read only for safety.

Crash recovery fallback

InnoDB may enter read only when forced recovery levels 4-6 are used or when corruption is detected.

Related Errors

Error 1290 - The MySQL server is running with the --read-only option

Global read only flag that blocks all writes, including non-InnoDB engines.

Error 1036 - Table 'tbl' is read only

Table-level permission or file-system issue affecting a single table rather than the whole engine.

Error 1205 - Lock wait timeout exceeded

Often reported when applications expect writes but are blocked by locks; may surface alongside read only misconfiguration.

Error 1877 - InnoDB read only restricts DDL/DML

Companion error triggered on specific statements when innodb_read_only is ON.

FAQs

Can I disable innodb_read_only without restart?

Yes, if MySQL was not started with the static --innodb-read-only flag. Use SET GLOBAL innodb_read_only = OFF, then verify with SHOW VARIABLES.

Will changing super_read_only affect replication?

Turning off super_read_only permits writes on replicas, which may break replication integrity. Keep it ON on replicas unless performing maintenance.

Why does SHOW VARIABLES show OFF but I still get the error?

A read only file-system or datadir permission issue can keep InnoDB effectively read only even when the variable is OFF. Check the OS layer and MySQL error log.

How does Galaxy help avoid this error?

Galaxy surfaces server variables and error logs directly in its sidebar, alerting engineers when innodb_read_only or super_read_only flip to ON so they can react before writes fail.

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