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.
--secure-file-priv option so it cannot execute this statementERROR 1290 secure-file-privThe MySQL server is running with the --secure-file-priv 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
- Move the file to the directory shown by
SHOW VARIABLES LIKE 'secure_file_priv' - Use
LOAD DATA LOCAL INFILEwithlocal_infile=1 - Use
mysqlimport/ client-side tools
Detailed fix by platform
MySQL
SHOW VARIABLES LIKE 'secure_file_priv';
my.cnf
secure_file_priv=/var/import(restart required; not changeable at runtime)
How to diagnose
- Variable — Value of secure_file_priv?
- Path — Inside it?
- 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:
Similar errors
Most viewed in MySQL
Other ways to find it
Where this error sits
Origin: Data. Errors that are often confused with or caused by this one (click to open):
🧠 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.
Report a correction or suggest an improvement
Last updated 2 Dec 2026