// MySQL error reference

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
Error message
The MySQL server is running with the %s option so it cannot execute this statement

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 INFILE or INTO OUTFILE with a path outside secure_file_priv.
  • Running ALTER USER while the server runs with --skip-grant-tables.

How to fix it

  1. See which option applies.

    SELECT @@read_only, @@super_read_only, @@secure_file_priv;
  2. 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;
  3. For file import and export, use the directory secure_file_priv names, or LOAD DATA LOCAL INFILE from the client if local_infile is enabled.

  4. With --skip-grant-tables, run FLUSH PRIVILEGES; first, then the account statement.

Related errors

More server limits and settings errors

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.

// fewer errors, faster fixes

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.