0
votes

I am learcing SQL and am trying to load a .csv file into it with "load infile" etc...

However I am getting the error, "The MySQL server is running with the --secure-file-priv so it cannot execute...".

I checked SHOW VARIABLES LIKE 'secure_file_priv' and it showed that the variable only allows loading data from C:\ProgramData\MySQL\MySQL Server 5.7\Uploads\

However after moving my data to that folder the same error keeps coming up. Can anybody help? Thanks. Andreas

1

1 Answers

1
votes

I had the same problem when loading csv-files. As in https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_secure_file_priv described, you can only read and write in the path in the variable secure-file-priv.

Therefore you have to include the full path in the query. Since you did not post a concrete query, I can only guess that you tried something like LOAD DATA infile 'temp_0.csv' INTO TABLE series_data_in;. It should work with something like LOAD DATA infile '/var/lib/mysql-files/temp_0.csv' INTO TABLE series_data_in; (or in your case LOAD DATA infile 'C:/ProgramData/MySQL/MySQL\ Server\ 5.7/Uploads/temp_0.csv' INTO TABLE series_data_in ; - be aware of correctly escaped spaces).