debugsqlMinor
error "--secure-file-priv option" when save selection to csv
Viewed 0 times
fileerrorsecureselectioncsvoptionsaveprivwhen
Problem
I try to save a very large select (more than 70 milion rows into csv file) on Win 2012 R2 server
I execute query as root , but I think there is still some problem with privileges
Error
Error Code: 1290. The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
Thank you in advance for any help !
I execute query as root , but I think there is still some problem with privileges
select *
INTO OUTFILE 'D:\my_folder\my_file.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
from my_table
where
...Error
Error Code: 1290. The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
Thank you in advance for any help !
Solution
I am using MySQL Server 8.0 on Windows 10. I tried to load data from csv file using the following commands:
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"
I tried many methods to solve the problem. Finally, I changed the '
I mean my new file path became
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"
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.Code Snippets
LOAD DATA INFILE 'C:\ProgramData\MySQL\MySQL Server 8.0\Uploads\World_cup_dataset.csv'
INTO TABLE trial
FIELDS TERMINATED BY ',';Context
StackExchange Database Administrators Q#123290, answer score: 5
Revisions (0)
No revisions yet.