csv数据导入到mysql

时间:2021-11-26 06:46:04
# 需要station_realtime存在
load data infile 'd:/xxxx/station_realtime2013_01.csv'
into table `station_realtime`
fields terminated
by ',' optionally enclosed by '"' escaped by '"'
lines terminated
by '\n';

注意导入文件的格式编码问题,我有N个csv文件,其中N-1个csv文件的编码都是UTF-8,mysql对应的DB也是UTF-8,导入没问题,

有一个文件不是UTF-8的,导入不成功,将该文件编码改为UTF-8就可以了