Reputation: 205
I just want to ask a question about importing a csv files to mysql tables. Because i have a csv file that contains 43762 rows but when i loaded it im my table it only inserted 2181 rows. I just wondering if there's a bug in my mysql.
Here's the output of my insert code:
mysql> load data local infile 'c:/database/cities_table2.csv'
-> into table ref_draft
-> fields terminated by ','
-> enclosed by '"'
-> lines terminated by '\n'
-> (municipality,name);
Query OK, 2181 rows affected, 2 warnings (0.28 sec)
Records: 2181 Deleted: 0 Skipped: 0 Warnings: 2
mysql> select count(*) from ref_draft;
+----------+
| count(*) |
+----------+
| 2181 |
+----------+
1 row in set (0.00 sec)
Is there other way to import large files?
Upvotes: 0
Views: 1372
Reputation: 205
Ok i solved my problem I just need to replace
lines terminated by '\n'
to
lines terminated by '\r\n'
Thanks for the immediate response sir.
Upvotes: 2
Reputation: 66
Did you turn off indexing? Also, make sure there's not a lot of incoming activity so you don't "hog" the server resources.
Upvotes: 2