当前位置:网站首页>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
边栏推荐
- Dry goods | summarize the linkage use of those vulnerability tools
- 供应链供需预估-[时间序列]
- Realize the IP address home display function and number home query
- LIS longest ascending subsequence problem (dynamic programming, greed + dichotomy)
- 如何让join跑得更快?
- 118. 杨辉三角
- Redis can only cache? Too out!
- 现在网上开户安全么?那么网上开户选哪个证券公司?
- mysql ”Invalid use of null value“ 解决方法
- Leetcode simple question sharing (20)
猜你喜欢
2022-7-7 Leetcode 34. Find the first and last positions of elements in a sorted array
Help tenants
Esp32 ① compilation environment
Digital IC Design SPI
[fortress machine] what is the difference between cloud fortress machine and ordinary fortress machine?
Use of polarscatter function in MATLAB
1. Deep copy 2. Call apply bind 3. For of in differences
Final review notes of single chip microcomputer principle
Redis can only cache? Too out!
Introduction to database system - Chapter 1 introduction [conceptual model, hierarchical model and three-level mode (external mode, mode, internal mode)]
随机推荐
Detr introduction
QQ medicine, Tencent ticket
Realize the IP address home display function and number home query
得物客服热线的演进之路
Lavarel之环境配置 .env
高等数学---第八章多元函数微分学1
Supply chain supply and demand estimation - [time series]
云计算安全扩展要求关注的安全目标和实现方式区分原则有哪些?
[etc.] what are the security objectives and implementation methods that cloud computing security expansion requires to focus on?
Mathématiques avancées - - chapitre 8 différenciation des fonctions multivariables 1
. Net core about redis pipeline and transactions
Help tenants
How far can it go to adopt a cow by selling the concept to the market?
Toraw and markraw
Ogre introduction
[high frequency interview questions] difficulty 2.5/5, simple combination of DFS trie template level application questions
flask session伪造之hctf admin
Laravel5 call to undefined function openssl cipher iv length() 报错 PHP7开启OpenSSL扩展失败
Oracle advanced (V) schema solution
现在网上开户安全么?那么网上开户选哪个证券公司?