0

I am using the following code to upload a table in mysql:

mysql> create table my_db.woof (`start_g` VARCHAR(10) NULL,   `v_0` INT NULL,   `v_1` INT NULL); 
  Query OK, 0 rows affected (0.12 sec)

mysql> LOAD DATA LOCAL INFILE '/Users/edamame/test1_data.csv' INTO TABLE woof FIELDS TERMINATED BY ','  LINES TERMINATED BY '\r\n' IGNORE 1 LINES (start_g,v_0,v_1); 
Query OK, 0 rows affected (0.00 sec)
Records: 0  Deleted: 0  Skipped: 0  Warnings: 0

The test1_data.csv looks like:

start_g,v_0,v_1
g1,11,12
g2,13,14

Even though there are no errors, no records are uploaded! Similar commands were working fine when uploading other tables ... did I miss anything in this specific case? Thank you!

1 Answer 1

0

Ok ... I figured it out ... the reason is some csv files hav line terminator as \r\n but some have \n.

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

1 Comment

\r\n will be for files generated in Windows and \n will be Linux and Unix based systems.

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.