当前位置:网站首页>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
边栏推荐
- flask session伪造之hctf admin
- AI人才培育新思路,这场直播有你关心的
- Clion mingw64 Chinese garbled code
- Read PG in data warehouse in one article_ stat
- Advanced Mathematics - Chapter 8 differential calculus of multivariate functions 1
- Laravel5 call to undefined function openssl cipher iv length() 报错 PHP7开启OpenSSL扩展失败
- Supply chain supply and demand estimation - [time series]
- 【日常训练】648. 单词替换
- LED light of single chip microcomputer learning notes
- Help tenants
猜你喜欢
Redis can only cache? Too out!
Best practice | using Tencent cloud AI willingness to audit as the escort of telephone compliance
Thread pool reject policy best practices
高等数学---第八章多元函数微分学1
566. Reshaping the matrix
Cmake learning and use notes (1)
Navicat运行sql文件导入数据不全或导入失败
Co create a collaborative ecosystem of software and hardware: the "Joint submission" of graphcore IPU and Baidu PaddlePaddle appeared in mlperf
1、深拷贝 2、call apply bind 3、for of for in 区别
Esp32 ① compilation environment
随机推荐
2022-7-6 beginner redis (I) download, install and run redis under Linux
带你掌握三层架构(建议收藏)
Realize the IP address home display function and number home query
Solve the cache breakdown problem
QQ medicine, Tencent ticket
2022-7-6 sigurg is used to receive external data. I don't know why it can't be printed out
mysql 局域网内访问不到的问题
cmake 学习使用笔记(一)
Mysql怎样控制replace替换的次数?
Signal strength (RSSI) knowledge sorting
1、深拷贝 2、call apply bind 3、for of for in 区别
2022-7-7 Leetcode 34. Find the first and last positions of elements in a sorted array
Ways to improve the performance of raspberry pie
Mathématiques avancées - - chapitre 8 différenciation des fonctions multivariables 1
数字ic设计——SPI
Read PG in data warehouse in one article_ stat
Custom thread pool rejection policy
How far can it go to adopt a cow by selling the concept to the market?
Learning breakout 2 - about effective learning methods
Esp32 construction engineering add components