当前位置:网站首页>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
边栏推荐
- xshell连接服务器把密钥登陆改为密码登陆
- ES日志报错赏析-Limit of total fields
- Centso7 OpenSSL error Verify return code: 20 (unable to get local issuer certificate)
- AI人才培育新思路,这场直播有你关心的
- Cinnamon taskbar speed
- 属性关键字Aliases,Calculated,Cardinality,ClientName
- 供应链供需预估-[时间序列]
- requires php ~7.1 -> your PHP version (7.0.18) does not satisfy that requirement
- 高等数学---第八章多元函数微分学1
- Redis can only cache? Too out!
猜你喜欢
【堡垒机】云堡垒机和普通堡垒机的区别是什么?
Leecode3. Longest substring without repeated characters
2022-7-6 初学redis(一)在 Linux 下下载安装并运行 redis
数据库系统概论-第一章绪论【概念模型、层次模型和三级模式(外模式、模式、内模式)】
118. 杨辉三角
Help tenants
Ogre introduction
Esp32 ① compilation environment
Redis 核心数据结构 & Redis 6 新特性详
JS slow motion animation principle teaching (super detail)
随机推荐
2022-7-6 使用SIGURG来接受外带数据,不知道为什么打印不出来
1. Deep copy 2. Call apply bind 3. For of in differences
Redis can only cache? Too out!
Social responsibility · value co creation, Zhongguancun network security and Information Industry Alliance dialogue, wechat entrepreneur Haitai Fangyuan, chairman Mr. Jiang Haizhou
Server to server (S2S) event (adjust)
Leecode3. Longest substring without repeated characters
Cinnamon taskbar speed
Read PG in data warehouse in one article_ stat
Problems that cannot be accessed in MySQL LAN
AI人才培育新思路,这场直播有你关心的
JS slow motion animation principle teaching (super detail)
2022-7-6 Leetcode27. Remove the element - I haven't done the problem for a long time. It's such an embarrassing day for double pointers
Redis 核心数据结构 & Redis 6 新特性详
Ways to improve the performance of raspberry pie
Final review notes of single chip microcomputer principle
My "troublesome" subordinates after 00: not bad for money, against leaders, and resist overtime
Talk about pseudo sharing
Detr introduction
[etc.] what are the security objectives and implementation methods that cloud computing security expansion requires to focus on?
PostgreSQL array type, each splice