msql导入csv

  load data infile 'D:/1.csv' --CSV文件存放路径
  into table test--要将数据导入的表名
  fields terminated by ',' optionally enclosed by '"' escaped by '"'
  lines terminated by '\r\n';

如果导入的是中文,通常会遇到乱码问题,解决方案如下:

load data local infile 'd:/1.csv' into table test 
character set 'utf8' 
fields terminated by ',';