1290 secure-file-priv MySQL Origin: Data OSI layer 7 · Application Last updated 2 Dec 2026

ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

LOAD DATA / SELECT INTO OUTFILE is restricted to one directory (or disabled) by secure_file_priv.

Exact message you may see --secure-file-priv option so it cannot execute this statementERROR 1290 secure-file-privThe MySQL server is running with the --secure-file-priv
Seen on: MySQL

Meaning

MySQL only reads or writes files in the folder named by secure_file_priv; NULL disables file operations; an empty value allows any path. The default since 5.7/8 is a restricted folder such as /var/lib/mysql-files.

Common causes

  • File outside the allowed directory
  • secure_file_priv = NULL
  • Path with wrong case or symlink
  • Cloud-managed MySQL forbids server-side file access

⚡ Quick fix

  1. Move the file to the directory shown by SHOW VARIABLES LIKE 'secure_file_priv'
  2. Use LOAD DATA LOCAL INFILE with local_infile=1
  3. Use mysqlimport / client-side tools

Detailed fix by platform

MySQL

  1. SHOW VARIABLES LIKE 'secure_file_priv';

my.cnf

  1. secure_file_priv=/var/import (restart required; not changeable at runtime)

How to diagnose

  1. Variable — Value of secure_file_priv?
  2. Path — Inside it?
  3. Managed — Cloud database?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Data. Errors that are often confused with or caused by this one (click to open):

1005 — MySQL ERROR 1005 (HY000): Can't create table (errno: 150 "Foreign key constraint is incorrectly formed") (MySQL)10051007 — MySQL ERROR 1007 (HY000): Can't create database 'x'; database exists (MySQL)10071008 — MySQL ERROR 1008 (HY000): Can't drop database 'x'; database doesn't exist (MySQL)10081022 — MySQL ERROR 1022 (23000): Can't write; duplicate key in table (MySQL)10221032 — Last_SQL_Errno: 1032 — Could not execute Delete_rows event on table; Can't find record in 'table' (MySQL)10321290 read-only — ERROR 1290 (HY000): The MySQL server is running with the --read-only option so it cannot execute this statement (MySQL)1290 read-onlyStorage files 404: public/storage symlink missing — Laravel: 404 for /storage/file.jpg — symlink(): No such file or directory / The [public/storage] link already exists (Laravel)Storage files 404: pu…1290 secu…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.