I already have a table in place which I'm trying to populate using the data from an external XML file. I'm using the LOAD XML INFILE
function for it, using the query below. However I'm getting a #1290 - The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
and the query is unable to execute. Can anybody please enlighten me as to what needs to be done so that I can execute it?
Here's the query for reference.
LOAD XML INFILE 'C:\\Users\Shubham\Desktop\Part_Info.xml'
INTO TABLE dbtest.part_no
ROWS IDENTIFIED BY '<row>';
I'm answering my own question as I found the answer myself.
For the specifics, I'm working on Windows and installed MySQL in-part with the general WAMP installation.
I tried the solution that @MikeT (in the comments above) suggested. The workaround mentioned was
secure-file-priv
brought by the SQL query SHOW VARIABLES LIKE "secure_file_priv";
However the error (for me atleast) still persisted. But the error was resolved (again, for me atleast) by using forward-slashes instead of backslashes using the file path, as indicated by the following SQL query
LOAD XML INFILE 'D://Secondary/wamp64/tmp/Part_Info.xml'
INTO TABLE dbtest.part_no
ROWS IDENTIFIED BY '<row>'
Hope it helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.