views:

242

answers:

1

Development machine is a Mac. I'm having some trouble importing more than a single line from a CSV into Mysql. Here is my SQL statement:

LOAD DATA LOCAL INFILE 'test.csv' 
INTO TABLE students
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(pita, dob, name, grd, asst, loc);

It runs fine, but only one record is imported. Any idea where I'm going wrong?

+3  A: 

Check the line endings:

head -n2 sql.sql | hexdump -C

but the most common problem, the line terminator isn't what you'd expect, try:

LINES TERMINATED BY '\r'
Mark L
+1. The Mac line-terminating character is a carriage return, not a line feed.
BipedalShark
Thank you, Mark L and BipedalShark! That was it.