Search code examples
mysqlmacosload-data-infile

Using Data Load Infile, terminal shows implemented, but no records were loaded into the table


I used DATA LOAD INFILE to load a txt file which is about 2.5MB. After I execute the query in MySql, it shows 0 rows effected.
Is that related to the file size? But there is no error popped up.

My data import query is:

load data local infile 'trips.txt '
into table trips
columns terminated by ','
lines terminated by '/n'
ignore 1 lines;

After entering the above query, I got:

Query OK, 0 rows affected (0.03 sec) 
Records: 0  Deleted: 0  Skipped: 0  Warnings: 0

I have used similar syntax to import another two files, which are fine.
Thanks for your help!


Solution

  • Try

    LINES TERMINATED BY '\n'
    

    or

    LINES TERMINATED BY '\r\n'