Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

LOAD Data file error

Status
Not open for further replies.

JimFL

Programmer
Jun 17, 2005
131
GB
Hi,

Im having problems trying to insert data from a comma delimited text file (in the format below) into my database table using phpmyAdmin.

<start of textfile>
BB11,2PX,S,38350,43160,2
BB12,7DE,S,37970,43280,9
BB18,6RD,S,39110,44670,34
BD 2,3BU,S,41770,43530,15
<end of textfile>


My table is set up to contain the postcodes data above and has the following fields:

field1 varchar(255)
field2 varchar(255)
field3 varchar(255)
field4 int(11)
field5 int(11)
field6 int(11)



I have set up a table with the same fields as my text file but the following error occurs

SQL-query :

LOAD DATA INFILE '/tmp/tempname' INTO TABLE `TABLE` FIELDS TERMINATED BY ',' ESCAPED BY '\\' LINES TERMINATED BY '\n'

MySQL said:


Access denied for user: '****database name****' (Using password: YES)
Back


Does anyone have any ideas why this is happening?


many thanks in advance



 
Do you have file permission privileges for that particular user?
 
Im not sure, please excuse me Im totally out of my depth regarding these issues. I have checked php myadmin and cant find a section on permissions. Is there a script I can run to test/check this?

 
When you have direct access to change mysql permissions then you would check the mysql database in the user table for specific row against the column file_priv.

Generally, if you are using a hosted service with phpmyadmin, you don't have such access to make the necessary changes.

I believe though you can get around the issue by using:
Code:
LOAD DATA LOCAL INFILE
instead of
Code:
LOAD DATA INFILE
 
Thanks, for that also.

However I called my host company and they set the permissions for me - so your initial answer was the correct solution.

Many thanks



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top