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

2
  • 1
    Are you sure about the line feed in your csv? Try the \r\n or \r instead of the \n Commented Nov 4, 2013 at 6:20
  • I have answered your question, if you want to close... for the posterity ;) Commented Nov 28, 2013 at 6:10

1 Answer 1

8

Probably your file line terminator differs from your definition in the LOAD DATA statement.

Try the \r\n or \r instead of the \n.

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

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.