How to Fix MySQL Error 1290 (ER_OPTION_PREVENTS_STATEMENT)

Published
Length
3 min read

Luis Felipe Dias

All posts

You get mysql error 1290 when an active server setting blocks your SQL statement. You fix it by routing your query to the right host or using an allowed folder. The database engine returns symbol ER_OPTION_PREVENTS_STATEMENT and SQL state HY000 during this failure. The message states that the server runs with an option that stops your statement. This rule protects the host and its data from unsafe actions. What causes mysql error 1290 in your database Two common server settings trigger mysql

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 get mysql error 1290 when an active server setting blocks your SQL statement. You fix it by routing your query to the right host or using an allowed folder.

The database engine returns symbol ER_OPTION_PREVENTS_STATEMENT and SQL state HY000 during this failure. The message states that the server runs with an option that stops your statement. This rule protects the host and its data from unsafe actions.

What causes mysql error 1290 in your database

Two common server settings trigger mysql error 1290 in most setups. The first cause is a file folder lock on the database host. Admins set up the server so it only reads and writes files in one safe folder. If you try to export or load files outside that path, the engine stops you. Even if you do not pick a path, an empty folder rule blocks all file tasks.

The second common cause is a read-only mode on the database server. Teams turn on read-only mode for replica nodes, standby hosts, or during maintenance windows. When a user or app sends a write statement to a read-only node, the query fails. Even users with high database roles can hit strict read-only locks on modern cloud databases.

A third cause happens when you run privilege updates while permission tables are turned off. If the server starts without loading grant tables, it blocks account changes until you reload grants.

How to check which server rule blocks your statement

Start by reading the exact error message returned by your database client. The message fills in the placeholder with the exact server option that blocked your task. Look at that option name to see if the block comes from file paths or read locks.

If the message points to a file path rule, check the allowed folder on the host. Ask your database admin which directory holds approved import and export files. Check that the database system account has operating system permissions to read and write there.

MySQL Access Governance + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

If the message shows a read-only rule, check which host your client uses. Many apps use a load balancer or DNS record that points to several database nodes. A recent failover may have moved your primary writer role to a new host. Make sure your client points to the active primary node before sending write queries.

How to fix the error safely in production

Never turn off safety rules across the whole server just to run one query. Disabling file path locks lets anyone with file rights read system files on the host. Instead, move your import file into the approved server folder and run the task again. You can also stream results through your client tool instead of writing files on the database host. When exporting customer tables, make sure data masking rewrites emails, phone numbers, and card numbers in results.

When you hit a read-only lock, do not turn off read-only mode on a replica node. Writing directly to a replica breaks replication and causes data drift across your cluster. Update your app settings so write queries go only to the primary cluster endpoint. If the primary node itself is stuck in read-only mode after maintenance, ask an admin to check cluster health first.

Inspect every MySQL query and response in flight

Static grants and network rules block bad logins. They cannot pause a risky query for review or mask emails in a result set. By design, hoop.dev sits inline in the MySQL protocol as a sidecar for your MySQL. For every plain query, prepared statement, or cursor an agent or human runs in production, hoop.dev decides to pass, mask, block, or hold it for review.

First, hoop.dev guardrails block banned actions before MySQL runs them, and an AI Analyzer you configure can score intent or escalate for approval. Next, hoop.dev data masking rewrites sensitive string columns in results in memory, and every verdict goes to the audit trail. Find the open-source binary on GitHub.

Frequently asked questions

Why do I get mysql error 1290 when exporting data to a file?

The server blocks file exports outside its approved folder path. Write the file to the allowed server folder or export results through your client tool.

Why does my admin user still hit a read-only error 1290?

Cloud databases and strict server modes block writes even for root and admin roles. You must send write queries to the primary writer node instead of a read replica.

Can I fix error 1290 without restarting the database server?

Yes, you can fix most cases without a restart. Point write queries to the primary host or move import files into the allowed server directory.

The query runs. The emails stay hidden.