I am trying to write a stored procedure to import CSV data from local system to mySQL tables. I do not want to use import wizard as I want SP to create, import and display time taken to import.
However, when I execute this statement:
LOAD DATA INFILE 'path/to/your/file.csv' INTO TABLE your_table_name FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 LINES; -- Use this if your file has a header row
I receive Error Code: 1290. The MySQL server is running with the --secure-file-priv option so it cannot execute this statement.
Things I have tried:
- Transfer files to path in secure_file_priv
C:\ProgramData\MySQL\MySQL Server 8.0\Uploads\ - Updated 'secure_file_priv'="" and 'local_infile'=1 in my.ini file at various locations, getting default file location from cmd, but the path is not updated when I check their updated values. I restart mySQL server each time after making changes but no luck.
- Unchecked Safe updates in mySQL preferences
Please let me know any workaround.