Jump to content

Cant use LOAD DATA INFILE


rondog

Recommended Posts

I have a CVS file with 2000+ entries that I need to input. I tried:

LOAD DATA INFILE 'http://www.website.com/store.csv'
INTO TABLE ssp_dealers
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(customer, street1, street2, city, state, zip);

 

but it says access denied.

 

I tried

LOAD DATA LOCAL INFILE 'http://www.website.com/store.csv'
INTO TABLE ssp_dealers
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(customer, street1, street2, city, state, zip);

 

and it says it cant find it...I dont have access to the server so I cant use the second example and LOAD DATA LOCAL INFILE and it appears my privelages for LOAD DATA INFILE are restricted. Any ideas of doing this..maybe a php script?

Link to comment
Share on other sites

I dont have it on the server I am working on, but I have it on another. Essentially what I can do is import it to the server that has phpMyAdmin and then export an SQL file. Now I tried using the import tool and it spit back an error:

 

at the top:

There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem

ERROR: Unclosed quote @ 121997
STR: '

 

then all my information..scroll down and the following error says:

MySQL said: Documentation
#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 'Denali Cigars,2026 McCullam,,Fairbanks,AK,99701
Lucky Raven,36312 Irons Avenue,' at line 1 

 

What happens when this succeeds? It didnt even ask what table I wanted to put it in?

Link to comment
Share on other sites

an sql engine tries to 'compile' the entire sql statement before it executes any of it so if it finds a parse error it will fail right there. I suspect your problem is that one of the fields you are trying to export has a single quote character in it that did not get escaped somewhere's along the line and then therefore is 'breaking' the sql which uses single quotes as part of the syntax.

 

open up the sql file and copy the part around the error to this board and we'll look at it.

 

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.