Hi all,
Im working on a large project, havent had to do what I need help with before. I have a csv file, it contains a large amount of data, namely all of the cities, towns, suburbs in Australia. I need to convert the csv file to sql for mysql, and then import it into the database.
What would be the best way to achieve this?
Thanks all, Lea
From stackoverflow
-
Use
LOAD DATA INFILEor the equivalent command-line toolmysqlimport.These are easy to use for loading CSV data, and this method runs 20x faster than importing rows one at a time with SQL.
Lea : Thanks. I did try to use the LOAD DATA INFILE method, but it would not accept my path to the csv file. Any suggestions?Romain Hippeau : @Lea - This is the way to go. What is the problem with the path ? +1Lea : @Romain Hippeau it simply returns the error "csv file not found". I tried to use the absolute path to the file, but it doesnt seem to accept it.Romain Hippeau : @Lea can you run it from the location where your csv file is located ?Bill Karwin : Try `LOAD DATA LOCAL INFILE` otherwise it wants the file to be under the MySQL Server's data directory.Romain Hippeau : @Lea - Did you try Bill's idea above ?
0 comments:
Post a Comment