I am using MySQL Server 8.0 on Windows 10. I tried to load data from csv file using the following commands:
LOAD DATA INFILE 'C:\ProgramData\MySQL\MySQL Server 8.0\Uploads\World_cup_dataset.csv'
INTO TABLE trial
FIELDS TERMINATED BY ',';
When I run above commands, I got
"ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement"
"ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement"
I tried many methods to solve the problem. Finally, I changed the '\
' characters in the file path to '/
' characters.
I mean my new file path became C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/World_cup_dataset.csv
and my problem were fixed. If you look at my.ini file located in the MySQL Server folder, the path of secure-file-priv
is "C:/ProgramData/MySQL/MySQL Server 8.0/Uploads
". So, this solution makes sense.