当前位置:网站首页>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
边栏推荐
- Read PG in data warehouse in one article_ stat
- Navicat运行sql文件导入数据不全或导入失败
- PHP中用下划线开头的变量含义
- Learning breakout 2 - about effective learning methods
- 2022-7-6 初学redis(一)在 Linux 下下载安装并运行 redis
- xshell连接服务器把密钥登陆改为密码登陆
- 数字ic设计——SPI
- Oracle advanced (V) schema solution
- 带你掌握三层架构(建议收藏)
- mysql导入文件出现Data truncated for column ‘xxx’ at row 1的原因
猜你喜欢
随机推荐
Indoor ROS robot navigation commissioning record (experience in selecting expansion radius)
Build a secure and trusted computing platform based on Kunpeng's native security
2022-7-7 Leetcode 844. Compare strings with backspace
提升树莓派性能的方法
《厌女:日本的女性嫌恶》摘录
2022-7-6 beginner redis (I) download, install and run redis under Linux
2022-7-6 初学redis(一)在 Linux 下下载安装并运行 redis
Split screen bug notes
为租客提供帮助
toRaw和markRaw
Solve the cache breakdown problem
ES日志报错赏析-Limit of total fields
【面试高频题】难度 2.5/5,简单结合 DFS 的 Trie 模板级运用题
Redis 核心数据结构 & Redis 6 新特性详
1. Deep copy 2. Call apply bind 3. For of in differences
Mongodb command summary
2022-7-7 Leetcode 844.比较含退格的字符串
[1] ROS2基础知识-操作命令总结版
Mongodb slice summary
[daily training -- Tencent select 50] 231 Power of 2