找回密码
 注册
查看: 3088|回复: 2

ERROR 1406 (22001): Data too long for column 'shell' at row 2 解决办法

[复制链接]

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
发表于 2020-6-17 15:26:23 | 显示全部楼层 |阅读模式
mysql> load data infile '/etc/passwd' into table gz.six fields terminated by ':' lines terminated by '\n';  
  \) I- e0 C0 }; zERROR 1406 (22001): Data too long for column 'shell' at row 2
2 S" a* ~6 {' u1 |6 `, B# `9 j+ I) |8 d' }% Y# W9 L3 M5 K/ X8 t

- t- ^- h* O0 @" R, ]7 [( Pmysql> load data infile '/etc/passwd' into table gz.six fields terminated by ':' lines terminated by '\n';
6 h6 S. X9 k2 b1 ?ERROR 1406 (22001): Data too long for column 'shell' at row 2
, e  I* G! e& ^2 G8 r% d
7 r5 N" Q; o7 Z. c, q  h0 q' Z* vRecords: 0  Duplicates: 0  Warnings: 0
* v+ G6 x4 Z8 x
2 n' t% M2 n+ P; R" `" yERROR 1406 (22001): Data too long for column 'shell' at row 2
( \5 M$ N8 g9 g报错提示字符太长,导致数据容量过大。5 Q7 B% }' {$ o$ P# N# y! O" m% y
解决办法:
5 t& g$ P& a( q; nmodify 修改字段类型
# q$ d. V! j0 M/ B+ v    modify 字段名 类型(宽度) 约束条件 , modify 修改个多个在后面田间,modify0 N! N: T. p4 T5 O. I
mysql> alter table six modify shell varchar(50);. c! p1 T+ L/ N1 G4 J

+ l$ T' @4 e4 [! i' o" JQuery OK, 0 rows affected (1.85 sec)( i: O( R- O, a0 }
Records: 0  Duplicates: 0  Warnings: 0
  q4 E1 k& \5 l: r! i0 b" P2 V
2 N. g( f2 Y% }" F" ^$ S* ?8 U. ~( Xmysql> alter table six modify shell varchar(50);
0 V) S1 p8 u' }6 Q- s, t) jQuery OK, 0 rows affected (1.85 sec)
! v6 h- c0 D! M: Q, t) \8 X: V. @# o+ p% I
mysql> load data infile '/etc/passwd' into table gz.six fields terminated by ':' lines terminated by '\n';
/ d1 U! J6 H: F4 a) M& b, {Query OK, 24 rows affected (0.29 sec)* R, p1 s; l! ]! h% D. o
Records: 24  Deleted: 0  Skipped: 0  Warnings: 0; |5 C6 [) ^1 j" M4 k" W

7 \# n; W$ D# r3 j; \- R8 F

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2020-6-17 15:26:47 | 显示全部楼层
mysql> load data infile '/etc/passwd' into table gz.six fields terminated by ':' lines terminated by '\n';  , Y9 Q) s- U3 ^5 y/ |0 a
ERROR 1406 (22001): Data too long for column 'shell' at row 2' X* o3 w; _, v9 {* A( k0 y8 Z9 F4 w
mysql> load data infile '/etc/passwd' into table gz.six fields terminated by ':' lines terminated by'\n';
$ C& [& w' D: Z( F8 \, SERROR 1406 (22001): Data too long for column 'shell' at row 2
+ S, D6 {* B% j( J' D& gmysql> load data infile '/etc/passwd' into table gz.six fields terminated by ':' lines terminated by '\n';
/ T5 t6 ]4 B# A. b6 U8 U) _) pERROR 1406 (22001): Data too long for column 'shell' at row 2: f/ \3 |. c. H( E& k  t8 p
mysql> alter table six modify shell varchar(50);
3 k3 e, ?0 k$ ]' M, D/ N7 PQuery OK, 0 rows affected (1.85 sec)
, b& Y  F0 S# c9 p# lRecords: 0  Duplicates: 0  Warnings: 0- t3 l- w: c5 v7 ^0 e
: K# f7 V! m3 x  y3 {7 q: E
mysql> load data infile '/etc/passwd' into table gz.six fields terminated by ':' lines terminated by '\n';
: z3 _* H  C/ C, Q; O4 a2 X8 Q8 YQuery OK, 24 rows affected (0.29 sec)* {5 D2 b. i  l* Q& c
Records: 24  Deleted: 0  Skipped: 0  Warnings: 0
2 q8 _- |& B" r3 K+ W6 @0 K! j

1

主题

0

回帖

12

积分

管理员

积分
12
QQ
 楼主| 发表于 2020-6-17 17:59:40 | 显示全部楼层
为了避免类似问题再次发生,可以使用定义参数限制条件大一点。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

返回首页|Archiver|手机版|小黑屋|易陆发现技术论坛 ( 蜀ICP备2026014127号-1 )

GMT+8, 2026-6-12 01:29 , Processed in 0.041379 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表