分享csv导入数据到mysql实例
程序员文章站
2022-04-09 19:07:33
...
csv表中含有中文字符,具体实现代码示例:
load data infile 'C:\\Users\\Administrator\\Desktop\\import\\CELLutf.csv' into table cell character set gbk(设置gbk字符编码,防止出现中文乱码)
fields terminated by ','
enclosed by '"'
lines terminated by '\r\n'
IGNORE 1 LINES;
代码解释:
fields terminated by ',':csv文件中数据之间的分隔符,csv文件默认以逗号分隔;
enclosed by '':指出封套符;
lines terminated by '':指行终止符;
IGNORE 1 LINES:忽略csv表头。
以上就是分享csv导入数据到mysql实例的详细内容,更多请关注其它相关文章!
推荐阅读