Reputation:
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?
Upvotes: 8
Views: 12950
Reputation: 13425
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'
Upvotes: 26