0

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?

1
  • Did you show the warnings to see what they say? I'd be curious. Commented Jul 30, 2013 at 1:13

2 Answers 2

2

Did you turn off indexing? Also, make sure there's not a lot of incoming activity so you don't "hog" the server resources.

Sign up to request clarification or add additional context in comments.

Comments

2

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.