简体   繁体   中英

Importing CSV to MySQL with Load Data Infile

I'm trying to load a CSV file into MySQL, and I keep getting syntax errors:

load data infile 'c:/worldminwage.csv' fields terminated by ',' enclosed
by '"' lines terminated by '\n' (YearlyWage, PercentGDP, Date
effective);

Can anyone help me get this working? Thanks.

Valid syntax is LOAD DATA INFILE 'c:/worldminwage.csv' INTO TABLE tablename .

You forgot to mention which table the data should go in. See LOAD DATA INFILE Syntax

I think This would be more batter

LOAD DATA INFILE 'c:/worldminwage.csv' fields terminated by ',';

Because you will get rid of error like columns numbers are not matching in the .csv file and mysql table

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM