4

I am trying to use mysql LOAD DATA INFILE on command line to load csv file. It neither gives any error nor it loads any data. Can anyone please help me out? I am using following command

mysql> LOAD DATA INFILE '/Applications/XAMPP/xamppfiles/htdocs/dev/__php__/mysql/data.csv'
->             INTO TABLE csvdata
->               FIELDS TERMINATED BY ','
->               OPTIONALLY ENCLOSED BY '"'
->               LINES TERMINATED BY '\n'
->               IGNORE 1 LINES;
Query OK, 0 rows affected (0.00 sec)
Records: 0  Deleted: 0  Skipped: 0  Warnings: 0

Following is my CSV file

"emp_id","first_name","last_name","username"
"EMP1","Tibass","Deloris","Tibass1"

Regards

4

1 回答 1

8

您的文件行终止符可能与您在LOAD DATA语句中的定义不同。

尝试使用\r\nor\r代替\n.

于 2013-11-28T06:07:38.123 回答