3197
MariaDBERRORCommonSecurityHIGH confidence
File path violates secure_file_priv restriction
Production Risk
High — security control; violation can expose sensitive files.
Why it happens
- 1LOAD DATA INFILE or SELECT ... INTO OUTFILE targeting a path outside secure_file_priv.
- 2secure_file_priv set to a specific directory and the target path is outside it.
How to reproduce
trigger — this will error
trigger — this will error
LOAD DATA INFILE '/etc/passwd' INTO TABLE t1;
expected output
ERROR 3197 (HY000): The path is not allowed. Verify the value of secure_file_priv system variable.
Fix 1
Move the file to the secure_file_priv directory
Move the file to the secure_file_priv directory
-- Copy file to /var/lib/mysql-files/ (default secure_file_priv) and retry.
Why this works
MySQL restricts file access to the secure_file_priv directory for security.
Fix 2
Reconfigure secure_file_priv if appropriate
Reconfigure secure_file_priv if appropriate
-- Set secure_file_priv = '/your/approved/path' in my.cnf and restart.
Why this works
Only change secure_file_priv if the new path is genuinely secure.
What not to do
✕
Sources
Official documentation ↗
MySQL 8.0 — 3197 ER_PATH_IN_DATADIR
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev