load data infile报错data too long for column
Posted 雅冰石
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了load data infile报错data too long for column相关的知识,希望对你有一定的参考价值。
一 问题描述
用select * from tqms.test_paper into outfile '/var/lib/mysql/test_paper.txt'导出
再用load data infile '/var/lib/mysql/test_paper.txt' into table tqms.test_paper导入的时候报错:
load data infile报错data too long for column id
二 解决办法
加上FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\\n'重新导出导入后发现不在报错了:
select * from tqms.test_paper into outfile '/var/lib/mysql/test_paper.txt' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\\n';
load data infile '/var/lib/mysql/test_paper.txt' into table tqms.test_paper FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\\n';
以上是关于load data infile报错data too long for column的主要内容,如果未能解决你的问题,请参考以下文章
PHP to LOAD DATA LOCAL INFILE 不起作用
MySQL:驱动程序从 5 更新到 8 后,LOAD DATA LOCAL INFILE 不起作用