Old 10-12-2007   #1 (permalink)
Rusty Bio-Hazard!
 
notjustgraphics's Avatar
 
Join Date: Sep 2006
Location: Toronto, Ontario, Canada
Posts: 1,034

Send a message via MSN to notjustgraphics
Trouble Importing Delimited Files into MySQL

This is an issue i just had to troubleshoot myself, and in my search for an answer I came across many threads posted by users with a similar predicament but little to no help.

Firstly, the ability to import delimited files (ie: CSV) into MySQL is obscurely hidden away at the bottom of the page when viewing the table structure... There is a line of text that read "INSERT DATA FROM A TEXT FILE INTO THE TABLE".

Clicking this option will present a form that allows you to select a file to upload to the server. It also allows you to define the delimiter, the carriage return marker, the escape character and an optional 'field encloser'.

The tricky part that catches most people of guard is the LOAD METHOD.

There are two options: DATA and DATA LOCAL.

Now most people assume that since they are uploading the file they want to import, the data is NOT local. Unfortunately, on most hosts, this will present you with a Access Denied error message.

You must choose DATA LOCAL if you get this error. The file will be uploaded to a /tmp directory on the server, and then MySQL will connect to the file to import the data, making it a LOCAL data transfer.

Alternatively, there are ways to import data into the table from a file already on the server using "LOAD DATA INFILE" but again, most hosts disable this feature for security reasons.

I just wanted to get this solution down somewhere so others looking for an answer don't have to go through what I did to get it to work.

Mike.
__________________
notjustgraphics is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-13-2007   #2 (permalink)
PHP Lover
 
Join Date: May 2007
Location: Zug, Switzerland
Posts: 84

Were you doing this through phpmyadmin? Because importing a file directly to MySQL from the command line is also relatively straight forward.
__________________
You can call me Greg or Greggy, as you wish
Gjbphp is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-15-2007   #3 (permalink)
Rusty Bio-Hazard!
 
notjustgraphics's Avatar
 
Join Date: Sep 2006
Location: Toronto, Ontario, Canada
Posts: 1,034

Send a message via MSN to notjustgraphics
Yes Gjbphp.. i was using phpMyAdmin, but the same issues are present with the command line method as well...

Where most intructions would suggest using LOAD DATA INFILE, it will fail on many shared hosts with little or no explanation.

Rather, you would have to use LOAD DATA LOCAL INFILE to solve the problems mentioned in my original post.

If you are referring to a mysql -u -p type command line, many people may not have shell access to their server... only control panel and phpMyAdmin.

Mike.
__________________
notjustgraphics is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 10-16-2007   #4 (permalink)
PHP Lover
 
Join Date: May 2007
Location: Zug, Switzerland
Posts: 84

Yes, Mike, I was referring to the command line approach rather than phpMyAdmin. Maybe one of us should mention this to the people at phpmyadmin, because I can imagine quite a few people being confused by this.

Greg
__________________
You can call me Greg or Greggy, as you wish
Gjbphp is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
importing brushes? Fetter Adobe Photoshop 2 04-12-2007 10:24 PM
Trouble with PS7? Snubs Adobe Photoshop 2 03-25-2007 03:27 PM
importing gif into photoshop document?? jawadah Adobe Photoshop 4 11-29-2006 06:42 PM
KathyM is here to cause trouble! LOL kathym Introductions 5 06-03-2006 11:56 AM
Importing Brushes sbole Adobe Photoshop 16 03-07-2006 10:15 AM


All times are GMT +1. The time now is 01:30 AM.
Content Relevant URLs by vBSEO 3.2.0

Design & Content © BioRUST 2007 :: PRIVACY STATEMENT :: LEGAL INFORMATION :: ADVERTISING MEDIA KIT