Thread: CSV to mySQL
View Single Post
  #9 (permalink)  
Old 07-01-2005, 04:14 PM
brian.mark's Avatar
brian.mark brian.mark is offline
Administrator
 

Join Date: Jul 2004
Location: Omaha
Posts: 2,717
brian.mark RepRank 2brian.mark RepRank 2
Default Re: CSV to MySQL

Quote:
Originally Posted by RichardLynch
If you have SSH access in the first place, you don't really need to muck around with port forwarding and mysqlfront, really...

1. Upload the CSV to the server, just like you would any HTML/JPG/XYZ file.

2. SSH in to the host, and use:

mysql -u YOURUSERNAME -p YOURDATABASE

You'll be prompted for your password.

Then you can use MySQL's LOAD DATA INFILE command with the path to your CSV file.

http://mysql.com will have more details about how to work this command.

You could even write some kind of shell script or a PHP script to do this automatically whenver you upload a new file to some special directory or something.

There may well be a tool out there to do what the original question asked.

I'd try to Google for:
csv2sql
and then for
"convert CSV to SQL INSERT"

If those don't turn up something, it probably doesn't exist, because everybody else found it easier to just use mysql built-in tools than make a special tool just for that.
That may be an option, but a GUI is much simpler for beginners.

I've been doing mysql stuff for 6 years now and prefer a decent gui to the command line interface. Command line works, but a typo makes it not work and a GUI prevents those.

Brian.
__________________
ToolBarn.com, an Internet Retailer Top 500 and Inc. 500 Company | Tool Parts | Pet Supplies
Reply With Quote