将CSV文件写入MySQL

先打开CSV文件查看第一行有哪些字段,然后新建数据库,新建表。(若字段内容很多建议类型text,如果设成char后续会报错)

命令如下:

load data infile '路径XXXX.csv'

into table 表名

fields terminated by ',' optionally enclosed by '"' escaped by '"'

lines terminated by '\r\n';

示意图:

搞定!

 

posted @ 2019-04-09 16:13  poziiey  阅读(511)  评论(0编辑  收藏  举报