mysqldude
Error codes › 1290

MySQL & MariaDB error 1290: The MySQL server is running with an option so it cannot execute this statement

MySQLThe MySQL server is running with the … option so it cannot execute this statement
MariaDBThe MariaDB server is running with the … option so it cannot execute this statement
Example from our test runs: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement (5.6.51) · The MariaDB server is running with the --read-only option so it cannot execute this statement (10.6.28)

A server setting blocks the statement. Most often --secure-file-priv (INTO OUTFILE / LOAD DATA outside the allowed directory) or --read-only (writes on a replica). The message names the option.

MySQLMariaDB
SymbolER_OPTION_PREVENTS_STATEMENTER_OPTION_PREVENTS_STATEMENT
SQLSTATEHY000HY000
TypeServer errorServer error
Versionsevery release since 5.0 activeevery release since 5.5 active

What it means

The statement is valid, but a server option forbids it. The end of the message says which one: --secure-file-priv, --read-only, --super-read-only or --skip-grant-tables.

Why it happens

  • --secure-file-priv: SELECT … INTO OUTFILE, LOAD DATA INFILE (without LOCAL) and LOAD_FILE() may only use the directory in @@secure_file_priv. Packaged MySQL sets it to a directory such as /var/lib/mysql-files/; NULL disables file operations completely. The official MariaDB Docker images leave it empty, so there INTO OUTFILE works anywhere the server process can write (tested on 10.6–11.8).
  • --read-only: the server is a replica, or a former primary that was demoted. Accounts without SUPER/CONNECTION_ADMIN can’t write. With super_read_only even administrators can’t.
  • --skip-grant-tables: while the server runs without privilege checking (for a password reset), account statements like CREATE USER and ALTER USER fail until FLUSH PRIVILEGES.

How to fix it

  • SELECT @@secure_file_priv; and write or read inside that directory. To change it, set secure_file_priv in my.cnf and restart; it can’t be changed at runtime.
  • Use client-side alternatives that don’t involve the server’s file system: mysql -e "SELECT …" > out.tsv, mysqldump --tab, or LOAD DATA LOCAL INFILE (see 3948).
  • For read-only: send writes to the primary. Check with SELECT @@read_only, @@super_read_only; and only turn it off on a server that is meant to be the primary.
  • After --skip-grant-tables, run FLUSH PRIVILEGES; first, then the account statement.

Reproduce it yourself

These steps are the exact test our harness runs. Use a scratch server, never production.

  1. Connect with mysql -u root -p and create a scratch database and the test data:

    CREATE DATABASE demo;
    USE demo;
    CREATE TABLE t (a INT);
    INSERT INTO t VALUES (1);
  2. As an admin, create a normal account and make the server read-only.

    CREATE USER 'appuser'@'%' IDENTIFIED BY 'Test#1234';
    GRANT INSERT ON demo.* TO 'appuser'@'%';
    SET GLOBAL read_only = 1;
  3. Write as the normal account. Admin accounts (SUPER / CONNECTION_ADMIN) are not blocked unless super_read_only is also on.

    mysql -u appuser -p -h 127.0.0.1 demo -e 'INSERT INTO t VALUES (2)'
  4. Put it back.

    SET GLOBAL read_only = 0;

You get: ERROR 1290 (HY000) at line 1: The MariaDB server is running with the --read-only option so it cannot execute this statement(11.8.9)

Verified fixes

  1. Check secure_file_priv and write inside that directory

    SELECT @@secure_file_priv;
    SELECT a INTO OUTFILE '/var/lib/mysql-files/out_demo.csv' FROM t;
    cat /var/lib/mysql-files/out_demo.csv

Tested on

StepMySQLMariaDB
5.65.78.08.4910.610.1111.411.8
SELECT ... INTO OUTFILE to /tmp with each server's default secure_file_priv (MariaDB images leave it empty, so it works)
version check
✗ 1290✗ 1290✗ 1290✗ 1290✗ 1290✓✓✓✓
A normal account writes while the server is read_only (a replica, or a failed-over primary)
repro
✓ 1290✓ 1290✓ 1290✓ 1290✓ 1290✓ 1290✓ 1290✓ 1290✓ 1290
Check secure_file_priv and write inside that directory
fix
✓✓✓✓✓✓✓✓✓
SELECT ... INTO OUTFILE to /tmp with each server's default secure_file_priv (MariaDB images leave it empty, so it works) version check
MySQL 5.6✗ 12905.7✗ 12908.0✗ 12908.4✗ 12909✗ 1290
MariaDB 10.6✓10.11✓11.4✓11.8✓
A normal account writes while the server is read_only (a replica, or a failed-over primary) repro
MySQL 5.6✓ 12905.7✓ 12908.0✓ 12908.4✓ 12909✓ 1290
MariaDB 10.6✓ 129010.11✓ 129011.4✓ 129011.8✓ 1290
Check secure_file_priv and write inside that directory fix
MySQL 5.6✓5.7✓8.0✓8.4✓9✓
MariaDB 10.6✓10.11✓11.4✓11.8✓
✓works ✓ 1062fails with the error the step demonstrates ⚠works with a warning ≠runs, result differs ✗fails Tested 2026-11-25 on 5.6.51, 5.7.44, 8.0.46, 8.4.13, 9.7.4, 10.6.28, 10.11.19, 11.4.13, 11.8.9
What the warnings and failures say (1)
  • SELECT ... INTO OUTFILE to /tmp with each server's default secure_file_priv (MariaDB images leave it empty, so it works) (MySQL 5.6, MySQL 5.7, MySQL 8.0, MySQL 8.4, MySQL 9): error 1290: The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

Related errors

  • 1227 ER_SPECIFIC_ACCESS_DENIED_ERRORexplained
  • 3948 ER_CLIENT_LOCAL_FILES_DISABLEDexplained
  • 1836 ER_READ_ONLY_MODE

Where this error shows up in our guides