How To Solve the LOAD DATA INFILE Error from –secure-file-priv
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
Leave Your Comment
All fields marked with "*" are required.