MySQL Read-Only Server Error: Post-Failover Demoted Primary, super_read_only Protection & ProxySQL Routing
Diagnosing write attempts against replica instances and demoted primaries retaining read_only mode, emergency topology triage, and ProxySQL routing split.
Operational Verification & Reliability Metadata
The error string is a symptom, not the root cause. Do not restart the server blindly. Run the diagnostic queries below to pinpoint the actual failure mode.
▸Symptom
Write queries (INSERT, UPDATE, DELETE) fail with:
ERROR 1290 (HY000): The MySQL server is running with the --read-only option so it cannot execute this statement
ERROR 1839 (HY000): Cannot execute statement: server is running with the --super-read-only option enabled▸What You See in Production
Following a failover event, application write paths fail completely while read requests continue normally.
▸Root Cause Matrix
| Probability | Root Cause | Description |
|---|---|---|
| %65 | Client Routing to Replica Target | Application pool points to read replica rather than promoted primary instance. |
| %25 | Demoted Primary Retained Read-Only | Former primary retained read-only mode after graceful topology failover. |
| %10 | `super_read_only` Safety Lock | Prevents even administrative users from writing to follower instances. |
▸EMERGENCY RUNBOOK (0-5 min)
-- 1. Inspect read-only flags
SELECT @@read_only AS ro, @@super_read_only AS sro;
-- 2. Confirm cluster member topology
SELECT * FROM performance_schema.replication_group_members;
-- 3. If THIS NODE IS CONFIRMED PRIMARY, disable read-only mode
SET GLOBAL read_only = OFF;
SET GLOBAL super_read_only = OFF;▸PERMANENT BLUEPRINT
- 1ProxySQL Topologies: Route write traffic through proxy layer capable of automated primary discovery.
- 2Enforce `super_read_only` on Replicas: Protect follower replicas from unintended administrative writes.
▸Verification
SELECT @@read_only, @@super_read_only;Other Database Error Triage Playbooks
Other battle-tested diagnostic guides for high-severity database errors.
MySQL ERROR 1045 Access denied: root Password Reset Guide
Four causes of MySQL 1045, meaning of using password: YES/NO, and safe credential recovery via --init-file.
MySQL Deadlock ERROR 1213: Graph Analysis and Permanent Prevention
Root causes of MySQL 1213 deadlock, parsing LATEST DETECTED DEADLOCK output, gap lock concurrency issues, and resilient application retry design.
MySQL Lock wait timeout exceeded: Finding Blocking Sessions
Finding the blocking transaction using performance_schema, safe KILL decision matrices, and permanent locking reduction.