PHP mysql "LOAD DATA LOCAL INFILE" stopped working :(

Following Query used to work and took seconds to insert about 20,000 records.

    LOAD DATA LOCAL INFILE
        '/latest.csv'
    INTO TABLE
        z_latest
    FIELDS TERMINATED BY ',' 
    OPTIONALLY ENCLOSED BY '"' 

EXPLAIN returns:

Trying to change quotes, add full path, different paths, permissions, etc all failed :frowning:

Googled extensively and I was unable to find a solution.

It is now taking over 30 minutes for the KLUDGE to insert the records one at a time :frowning:

Something’s fishy there… your error message doesn’t align with the quoted query. You sure it’s THIS query that’s throwing the error?

Whoops, truncated the full path and forgot to remove the leading directory forward slash. I tried the full path and also relative paths, neither worked.

The error indicates it’s borking before the first word, which would (to me) generally indicate you’ve put something in front of the query that the engine doesn’t like. LOAD is a valid keyword for MySQL. Make sure there’s no strange characters lingering on the front end of your string, or if this is being chained by multiple queries, make sure the previous query was terminated correctly.

I double checked and there are no spurious characters.

The query was working just over a year ago and I think according to numerous searches that there has been security changes added which have caused the problem.

If someone has a PhpMyAdmin available, I would be grateful if they could try using a CSV file with a couple of lines and a test database table? The PHP query also fails and may be simpler to try.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.