PDA

View Full Version : Import .csv via mysql



hofmax
07-11-2008, 05:32 PM
I am having problems with this. After a bit of trying around I came up with below query which worked but I got an annoying error also stated below. Can somebody see what is wrong?


SQL query:

LOAD DATA INFILE '/home/xxx/public_html/temporarydir/__file__.csv' INTO TABLE slots CHARACTER SET utf8 FIELDS TERMINATED BY ';' ENCLOSED BY '"' ESCAPED BY '\\' LINES TERMINATED BY 'AUTO'

MySQL said: Documentation
#1045 - Access denied for user 'xxx'@'localhost' (using password: YES)

charlesp
07-12-2008, 02:49 AM
There is a problem accessing your database. The username and/or the pw is wrong. The username is your BHusername followed by '_' like so:

BHusername_username(associated with the database) The database name is 'BHusername_databasename'

hofmax
07-12-2008, 06:27 AM
I got confirmation from support today that


The function LOAD DATA INFILE '/home/xxx/public_html/ requires access customers do not have, you will need to look into a php/perl script to parse the csv and insert into your database. An example can be found here: http://forums.mysql.com/read.php?52,53968,55220#msg-55220 or you can try a utility like http://www.phpcsvimporter.co.uk/

Will try these tools now. So for the record the normal sql query aimed at importing csvs does not work with the privileges on bluehost shared hosting.