找回密码
 注册
查看: 3089|回复: 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';  0 p0 G* t( S( ]
ERROR 1406 (22001): Data too long for column 'shell' at row 2
( M9 @2 A; H7 K' r8 x/ Z/ w! I4 g5 Z- M& ?& R8 L

: j# n  q) P0 g% p0 p; d4 S- Imysql> load data infile '/etc/passwd' into table gz.six fields terminated by ':' lines terminated by '\n';
( f0 T* Y; j8 G5 R' FERROR 1406 (22001): Data too long for column 'shell' at row 2
- v- d; w8 p. @9 M5 l; x3 t6 j2 L3 @7 A2 m. U5 E
Records: 0  Duplicates: 0  Warnings: 0) F9 M  \' r8 [+ `& _# D* u" O

+ ^6 [! D- {2 Q% s. z3 q) X3 UERROR 1406 (22001): Data too long for column 'shell' at row 2
# Z: t) J  \' o. g  s( H5 B报错提示字符太长,导致数据容量过大。
/ U! ?8 a1 F$ V+ r: B5 v- V解决办法:
+ y  O6 |3 U3 Y1 t0 t7 a5 Wmodify 修改字段类型5 `  X; _. a: N# j/ W9 \
    modify 字段名 类型(宽度) 约束条件 , modify 修改个多个在后面田间,modify
" U0 m+ H0 @$ Y) H0 [, ~6 E6 g: s/ ^+ smysql> alter table six modify shell varchar(50);, M# [. r5 k- F9 w

% J) e1 H1 c, W8 d6 e6 k8 C% CQuery OK, 0 rows affected (1.85 sec)
% d8 Q! t/ a$ J- O$ b; J# `Records: 0  Duplicates: 0  Warnings: 0
, _% l+ {$ S* e8 v7 M3 Y0 i1 b4 k2 j7 X9 x
mysql> alter table six modify shell varchar(50);
8 @+ u+ t* _. T) ]+ N( bQuery OK, 0 rows affected (1.85 sec)
5 h2 H) P& P- F8 u3 V9 F( C- F( A9 C4 G5 E, b
mysql> load data infile '/etc/passwd' into table gz.six fields terminated by ':' lines terminated by '\n';
) j0 O! P+ I2 |4 {; LQuery OK, 24 rows affected (0.29 sec), n$ s9 z/ d. u+ s/ ^! c; Y
Records: 24  Deleted: 0  Skipped: 0  Warnings: 00 ?6 f) r' W& G+ O3 t# T, W+ ]
6 x* u  F- J$ `1 K9 s0 l# j" V

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';  * H9 s% Y% M4 }6 W: \$ G9 R/ E
ERROR 1406 (22001): Data too long for column 'shell' at row 22 e, a7 i2 Y3 e, W
mysql> load data infile '/etc/passwd' into table gz.six fields terminated by ':' lines terminated by'\n';. Z+ m) d6 O! Q( _
ERROR 1406 (22001): Data too long for column 'shell' at row 2, V1 h& y9 G3 T  m% }5 [2 {7 S# [
mysql> load data infile '/etc/passwd' into table gz.six fields terminated by ':' lines terminated by '\n';% O8 K) q" Q! f/ q& [1 U
ERROR 1406 (22001): Data too long for column 'shell' at row 22 ], x$ v, y' O0 V, J3 X$ U/ c' T
mysql> alter table six modify shell varchar(50);3 ^6 U0 u/ ^2 Z* P
Query OK, 0 rows affected (1.85 sec)/ j3 u) a, l3 ?9 K
Records: 0  Duplicates: 0  Warnings: 0  |' B( f$ t- J( e  A9 ^' C. ]# `

6 j9 d3 C/ Q1 B/ M5 C7 I. P7 U& Emysql> load data infile '/etc/passwd' into table gz.six fields terminated by ':' lines terminated by '\n';) Q7 G2 _, U0 z0 ]
Query OK, 24 rows affected (0.29 sec)
7 @+ b9 V* ~( L( S; e- q$ iRecords: 24  Deleted: 0  Skipped: 0  Warnings: 0
3 V- b" U) }" [' q2 i# G

1

主题

0

回帖

12

积分

管理员

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

本版积分规则

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

GMT+8, 2026-6-12 02:20 , Processed in 0.015301 second(s), 21 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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