MySQL imports only one row from CSV

Development Machine - Mac. I am having problems importing more than one row from 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 works fine, but only one record is imported. Any idea where I'm wrong?

+5
source share
1 answer

Check line endings:

head -n2 sql.sql | hexdump -C

but the most common problem, the line terminator is not what you expect, try:

LINES TERMINATED BY '\r'
+25
source

All Articles