Learn how to fix MySQL ERROR 1290 running with read-only option. Our Support team is ready to assist you.
How to Fix MySQL ERROR 1290 Running with Read-Only Option
MySQL ERROR 1290 running with read-only option is a common issue developers encounter when working with MySQL, whether on small personal projects or enterprise-grade applications. MySQL is a powerful, flexible database system widely used for handling structured data. However, this specific error can halt your workflow if you’re unsure what’s causing it or how to fix it. In this guide, we’ll explain what triggers MySQL ERROR 1290 Running with Read-Only Option and walk you through the proven fixes to get your database fully operational again.
An Overview
What Is MySQL?
MySQL is a free, open-source relational database management system (RDBMS) that uses Structured Query Language (SQL). It powers many web applications due to its speed, reliability, and ease of use. MySQL enables developers to store, retrieve, and manage data efficiently, everything from user profiles to product inventories.
What Is MySQL ERROR 1290 Running with Read-Only Option?
You connect via MySQL Workbench or the command line, try to run an INSERT
, UPDATE
, or DELETE -
and hit this:
ERROR 1290 (HY000): The MySQL server is running with the --read-only option, so it cannot execute this statement.
Copy Code
In simple terms, the server is in read-only mode, blocking any write operations. It’s like trying to edit a locked document, you can view but not change anything.
Why MySQL Goes Read-Only
There are two common reasons:
1. Cloud Services (e.g., AWS Aurora)
Services like AWS Aurora often run multi-instance clusters with designated Writer and Reader endpoints. Only the Writer instance allows write operations; others are read-only.
2. Manual Configuration
Sometimes, server settings are manually changed (often during maintenance), enabling the read_only
variable globally to prevent modifications.
Fix #1 – AWS Aurora: Writer vs. Reader Endpoint
AWS Aurora provides two types of endpoints: Writer and Reader. When configuring MySQL Workbench, make sure to use the Writer endpoint, not the Reader one, to avoid the ‘read-only option’ error. The Writer (or cluster) endpoint connects to the primary instance, allowing both read and write operations. Switching to the correct endpoint resolved the issue and enabled successful DML execution.
Fix #2 – Check MySQL Global Variable
Not using AWS? Then the issue might be a configuration at the server level.
Check the global read_only
variable:
SHOW GLOBAL VARIABLES LIKE ‘read_only’;
-- response:
| Variable_name | Value |
| read_only | ON |
Copy Code
The read_only option in the server is set to ON.
To turn it off, you can use the SET GLOBAL statement as shown below:
SET GLOBAL read_only=0;
The option should now be turned off.Now I can run the UPDATE statement for my cities table just fine:
mysql> UPDATE cities SET city_name = "York" WHERE id = 1;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
Copy Code
Cloud-Specific: innodb_read_only
Cloud platforms like AWS might enforce read-only status at the storage engine level with the innodb_read_only
setting.
Check it with:
SHOW GLOBAL VARIABLES LIKE ‘innodb_read_only’;
Cloud services like AWS Aurora use multiple database instances, where only the primary (master) allows writes, secondary (replica) instances are read-only. Check your provider’s documentation for details, as others may follow a similar setup. This is key to resolving MySQL ERROR 1290.
The Takeaway
MySQL ERROR 1290 often boils down to trying to write to a read-only database. Whether it’s a cloud-related misconfiguration or a global variable setting, the fix is usually simple.
Final Checklist
-
Are you using the Writer endpoint (for AWS Aurora)?
-
Is
read_only
orinnodb_read_only
set to ON? -
Can you change it using
SET GLOBAL read_only=0;
?
[If needed, Our team is available 24/7 for additional assistance.]
Conclusion
The read-only mode in MySQL isn’t an error, it’s a safeguard. Now that you know what triggers ERROR 1290 and how to resolve it, you can quickly get your database back to optimal performance. Understanding the cause saves time and keeps your project on track.
0 Comments