将CSV格式数据导入 mysql,报错:
load data infile 'f:/nmg.csv' into table nmg fields terminated by ',' optionally enclosed by '"' escaped by '"' lines terminated by '\r\n';
报错:Invalid utf8mb4 character string: '"'
解决方法:
1、如果是 windows环境加上 CHARACTER SET gbk
load data local infile 'xxx.csv' into table t1
CHARACTER SET gbk
fields escaped by '\\' terminated by ',' lines terminated by '\n'
2、新建一个gbk编码的数据库,然后新建一个gbk编码的表,在进行导入即可。
如果还是不能接,则参考下面的文章: