How To Solve the LOAD DATA INFILE Error from –secure-file-priv

Published Date Author: , Posted June 12th, 2019 at 9:43:30am

The Problem

Tried to load a Tab-delimited text file into MuSQL 5.6.43 and got the following error:

mysql> LOAD DATA INFILE 'sample.txt' INTO TABLE test_table;
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

Solution One

mysql> SHOW VARIABLES LIKE "secure_file_priv";

Copy the file into the returned directory from above and call the full path in the load data command:

mysql> LOAD DATA INFILE '/var/lib/mysql-files/sample.txt' INTO TABLE test_table;

Solution Two

Add the LOCAL keyword:

mysql> LOAD DATA LOCAL INFILE 'sample.txt' INTO TABLE test_table;

References:

10 MySQL Load Data Infile Examples to Upload Text File Data to Tables


https://stackoverflow.com/questions/32737478/how-should-i-tackle-secure-file-priv-in-mysql

No comments as yet.

Leave Your Comment  Leave a comment

All fields marked with "*" are required.