MySQL error 1290: Server option prevents this statement
A server option forbids the statement, such as --read-only, --super-read-only or --secure-file-priv. The message names the option.
- Error number
1290- Name
ER_OPTION_PREVENTS_STATEMENT- SQLSTATE
HY000- Category
- Server limits and settings
What it means
MySQL refuses statements that a startup or global option disallows. The common ones: --read-only or --super-read-only on a replica or failover target blocks writes; --secure-file-priv restricts LOAD DATA INFILE and SELECT ... INTO OUTFILE to one directory (or disables them); --skip-grant-tables blocks account statements until you run FLUSH PRIVILEGES.
Common causes
- Writing to a replica, or to a primary that was set read-only during maintenance or failover.
LOAD DATA INFILEorINTO OUTFILEwith a path outsidesecure_file_priv.- Running
ALTER USERwhile the server runs with--skip-grant-tables.
How to fix it
-
See which option applies.
SELECT @@read_only, @@super_read_only, @@secure_file_priv;
-
Point writes at the primary. Turn read-only off only if this server should accept writes.
SET GLOBAL super_read_only = OFF; SET GLOBAL read_only = OFF;
-
For file import and export, use the directory
secure_file_privnames, orLOAD DATA LOCAL INFILEfrom the client iflocal_infileis enabled. -
With
--skip-grant-tables, runFLUSH PRIVILEGES;first, then the account statement.
Related errors
1792Write in a READ ONLY transaction1175Safe update mode blocked the statement1227Access denied; you need a privilege
More server limits and settings errors
1040Too many connections1203User has more than max_user_connections1153Got a packet bigger than max_allowed_packet1114The table is full
The code and message text are from the MySQL 8.4 Error Message Reference. Browse the full MySQL error list or search every database error.
Work on MySQL in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for MySQL and the other databases you use.