1

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>'; 
Shubham Mehta
  • 89
  • 2
  • 14
  • Have a look at [MySQL : How to tackle --secure-file-priv](http://stackoverflow.com/questions/32737478/mysql-how-to-tackle-secure-file-priv) – MikeT Jun 11 '16 at 08:49
  • @MikeT Thank you for the reference link you shared. I'm afraid I had already seen it and some other questions like this. I tried the workaround he suggests (of moving the file to the location prompted by `SHOW VARIABLES LIKE "secure_file_priv";`) but it did't work and I'm still stuck with the same error as before. – Shubham Mehta Jun 11 '16 at 10:06

1 Answers1

0

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

  • To move the file you want to import to the directory specified by 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.

Shubham Mehta
  • 89
  • 2
  • 14