trying to use "LOAD DATA LOCAL INFILE " to import

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
aussie_clint
Forum Commoner
Posts: 41
Joined: Mon Jul 31, 2006 9:14 am
Location: Brisbane, Australia
Contact:

trying to use "LOAD DATA LOCAL INFILE " to import

Post by aussie_clint »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


trying to import data using a query, trying to use MySQL Query Browser but cant seem to work out where on the server to put the csv file... iv tired uploading it to public_html and also the main directory... would it be best to do a php page and put the csv file in the same directory or something like that? or is there a better function to use?
thanks
clint

[syntax="sql"]LOAD DATA LOCAL INFILE '/newprice.csv'
INTO TABLE `newprice list`
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'


start of csv file[/syntax]

Code: Select all

PartNumber,Description,CategoyName,CategoryID,ExTax,IncTax
ADDBT-122,DLINK DBT-122 BLUETOOTH USB ADAPTER,ACCESSORIES,2500,55,60.5
ADDBT-GTE-410,BESTA USB BLUETOOTH DONGLE (100M),ACCESSORIES,2500,39,42.9
ADUP,USB TO PS/2 ADAPTOR,ACCESSORIES,2500,3,3.3
BCASECD,CD / DVD CASE - CARRIES 2 DVD OR CD,BLANK MEDIA,3200,0.4,0.44
BCASEDVD,"DVD CASE - CARRIES 1 DVD (7mm, BLACK)",BLANK MEDIA,3200,0.25,0.28
BCASEDVDS,"DVD CASE - CARRIES 1 DVD (14mm, BLACK)",BLANK MEDIA,3200,0.4,0.44
BCASEDVDSL,DVD/CD SLEEVES (100 PCS),BLANK MEDIA,3200,3,3.3
BCDAT(50),ATERRA 50 PCS CD-R 80MIN 40x BLANK CD,BLANK MEDIA,3200,20,22
BCDB50,BENQ GOLD CD-R 50PCS SPINDLE,BLANK MEDIA,3200,13,14.3
BCDBRW32,BENQ 32x CDRW (10 PCS SLIMELINE CASE),BLANK MEDIA,3200,12,13.2
BCDLP,"LASER CDR 52X 80min/700MB (50PCS, PRINTABLE)",BLANK MEDIA,3200,15,16.5
BCDM10,MITSUBISHI 700MB 48x CD-R (10PCS JEWEL CASE),BLANK MEDIA,3200,7,7.7
BDVDA10-,ACCESS DVD-R 16X MEDIA (10PCS SPINDLE),BLANK MEDIA,3200,3.5,3.85
BDVDA50-,ACCESS DVD-R 16X MEDIA (50PCS) PRINTABLE,BLANK MEDIA,3200,18,19.8

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

/newprice.csv would be a reference to the server's root. If your public_html directory is at /home/someuser/public_html and you placed the file there, then similarly it would be /home/someuser/public_html/newprice.csv
aussie_clint
Forum Commoner
Posts: 41
Joined: Mon Jul 31, 2006 9:14 am
Location: Brisbane, Australia
Contact:

Post by aussie_clint »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


i still ant able to get it too work, i had a look at the host site and found the folder but it still saying it cant find the folder

[syntax="sql"]LOAD DATA LOCAL INFILE '/home/computer/public_html/newprice.csv'
INTO TABLE `newprice list`
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'

feyd | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Are you by chance connecting to a remote server, not the machine that's running MySQL Query Browser? If so, you may need to remove the LOCAL keyword.
aussie_clint
Forum Commoner
Posts: 41
Joined: Mon Jul 31, 2006 9:14 am
Location: Brisbane, Australia
Contact:

Post by aussie_clint »

Now it saying access denied, I when to control panel of my web hosting and I have the privileges set to all
Post Reply