Search code examples
mysqlxmlloadlocalload-data-infile

MySQL LOAD XML LOCAL INFILE


I'm building an application on my local machine, and for the longest time, was using Windows 7 with MySQL installed, but as I've now moved onto Linux, I'm trying to execute this statement:

LOAD XML LOCAL INFILE 'http://example.com/tech.xml'

INTO TABLE t

ROWS IDENTIFIED BY '<product>';

This is not working, and I do have all the privileges necessary in order to accomplish this.

How can I make this statement work?

When I was using Windows (r) the statement would work perfectly. Where do I put the file on my web server if I want to access it via MySQL?

I get this error:

Error Code: 1064. You have an error in your SQL syntax; check the manual that          
corresponds to your MySQL server version for the right 
syntax to use near 'XML LOCAL INFILE 'http://example.com/tech.xml'

INTO TABLE t

ROWS IDENTIFIE' at line 1

Solution

  • LOAD XML INFILE is available from mySQL 5.2 and higher.

    You probably have an older version than that.