当前位置:网站首页>The reason why data truncated for column 'xxx' at row 1 appears in the MySQL import file
The reason why data truncated for column 'xxx' at row 1 appears in the MySQL import file
2022-07-07 13:51:00 【Full stack programmer webmaster】
mysql When importing files, it is easy to see ”Data truncated for column ‘xxx’ at row x”, In the string xxx and x It refers to the specific number of columns and rows .
occasionally , This is because the data types do not correspond , Or the string length is not enough .
however , Often appear row 1 Just report a mistake , And I feel that there is nothing wrong with it .
This is often because windows Enter and change lines ”\r\n” setting , The following tests illustrate this .
I have one train.csv Data files for , I use python Save as after modification c.csv.
however , I use the same command to import them into mysql when ,train Can be imported ,c But it went wrong .
I change the line terminator from ”\n” Switch to ”\r\n” after , Successful import .
use notepad Open these two files , Will find train There is no new line , and c Then there is line feed .
This explanation train Only in Li ”\n”, therefore notepad Unrecognized line breaks , and c Inside, it is ”\r\n”.
But with python Generate c.csv When , The output is only ”\n”, This explanation python stay win It will automatically turn ”\n” become ”\r\n”.
The other thing is , except notepad Most of the outside win Under the editor , Both can recognize ”\n” And can recognize ”\r\n”.
So only use notepad To know what it is ”\n” still ”\r\n”, Or use winHex Wait for tools to see directly ascii code .
The final conclusion is , Note that the newline of this data file is ”\n” still ”\r\n”.
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/113289.html Link to the original text :https://javaforall.cn
边栏推荐
- Distributed transaction solution
- 2022-7-6 Leetcode27.移除元素——太久没有做题了,为双指针如此狼狈的一天
- Flink | multi stream conversion
- 【面试高频题】难度 2.5/5,简单结合 DFS 的 Trie 模板级运用题
- 现在网上开户安全么?那么网上开户选哪个证券公司?
- Ikvm of toolbox Net project new progress
- Getting started with cinnamon applet
- Write it down once Net a new energy system thread surge analysis
- 云计算安全扩展要求关注的安全目标和实现方式区分原则有哪些?
- 作战图鉴:12大场景详述容器安全建设要求
猜你喜欢

566. Reshaping the matrix

2022-7-6 sigurg is used to receive external data. I don't know why it can't be printed out

2022-7-7 Leetcode 844.比较含退格的字符串

cmake 学习使用笔记(一)

Battle Atlas: 12 scenarios detailing the requirements for container safety construction

Co create a collaborative ecosystem of software and hardware: the "Joint submission" of graphcore IPU and Baidu PaddlePaddle appeared in mlperf

Error lnk2019: unresolved external symbol

Show the mathematical formula in El table

Talk about pseudo sharing

2022-7-7 Leetcode 34. Find the first and last positions of elements in a sorted array
随机推荐
Split screen bug notes
LeetCode简单题分享(20)
2022-7-6 初学redis(一)在 Linux 下下载安装并运行 redis
cmake 学习使用笔记(一)
Final review notes of single chip microcomputer principle
[1] ROS2基础知识-操作命令总结版
Redis只能做缓存?太out了!
Leecode3. Longest substring without repeated characters
干货|总结那些漏洞工具的联动使用
Mongodb slice summary
内存溢出和内存泄漏的区别
[high frequency interview questions] difficulty 2.5/5, simple combination of DFS trie template level application questions
[fortress machine] what is the difference between cloud fortress machine and ordinary fortress machine?
提升树莓派性能的方法
The delivery efficiency is increased by 52 times, and the operation efficiency is increased by 10 times. See the compilation of practical cases of financial cloud native technology (with download)
【面试高频题】难度 2.5/5,简单结合 DFS 的 Trie 模板级运用题
requires php ~7.1 -> your PHP version (7.0.18) does not satisfy that requirement
最佳实践 | 用腾讯云AI意愿核身为电话合规保驾护航
DID登陆-MetaMask
Ways to improve the performance of raspberry pie