当前位置:网站首页>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
边栏推荐
- 【堡垒机】云堡垒机和普通堡垒机的区别是什么?
- 为租客提供帮助
- 118. Yanghui triangle
- 如何让join跑得更快?
- Realize the IP address home display function and number home query
- Lavarel之环境配置 .env
- Centso7 OpenSSL error Verify return code: 20 (unable to get local issuer certificate)
- 高等数学---第八章多元函数微分学1
- 566. 重塑矩阵
- [etc.] what are the security objectives and implementation methods that cloud computing security expansion requires to focus on?
猜你喜欢
Custom thread pool rejection policy
10 pictures open the door of CPU cache consistency
Sliding rail stepping motor commissioning (national ocean vehicle competition) (STM32 master control)
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)
QQ medicine, Tencent ticket
作战图鉴:12大场景详述容器安全建设要求
2022-7-6 初学redis(一)在 Linux 下下载安装并运行 redis
"Song of ice and fire" in the eleventh issue of "open source Roundtable" -- how to balance the natural contradiction between open source and security?
AI人才培育新思路,这场直播有你关心的
2022-7-7 Leetcode 844.比较含退格的字符串
随机推荐
[fortress machine] what is the difference between cloud fortress machine and ordinary fortress machine?
Getting started with MySQL
Cinnamon taskbar speed
Learning breakout 2 - about effective learning methods
Some principles of mongodb optimization
Fast development board pinctrl and GPIO subsystem experiment for itop-imx6ull - modify the device tree file
带你掌握三层架构(建议收藏)
What parameters need to be reconfigured to replace the new radar of ROS robot
内存溢出和内存泄漏的区别
2022-7-7 Leetcode 34. Find the first and last positions of elements in a sorted array
搜索框效果的实现【每日一题】
Clion mingw64 Chinese garbled code
供应链供需预估-[时间序列]
My "troublesome" subordinates after 00: not bad for money, against leaders, and resist overtime
如何让join跑得更快?
Realize the IP address home display function and number home query
干货|总结那些漏洞工具的联动使用
Mongodb replication (replica set) summary
.net core 关于redis的pipeline以及事务
实现IP地址归属地显示功能、号码归属地查询