易陆发现互联网技术论坛

 找回密码
 开始注册
查看: 3087|回复: 2
收起左侧

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

[复制链接]
发表于 2020-6-17 15:26:23 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?开始注册

x
mysql> load data infile '/etc/passwd' into table gz.six fields terminated by ':' lines terminated by '\n';  
' \: ]9 H3 `3 qERROR 1406 (22001): Data too long for column 'shell' at row 2  W8 p0 g9 j, {; j; e# H3 u$ o8 E2 h
7 c- [; q  [+ [% Y

( F( ?/ Q; @% }" F$ Y" m. umysql> load data infile '/etc/passwd' into table gz.six fields terminated by ':' lines terminated by '\n';
4 B. _) o. t$ Q2 O; Y' C6 L' eERROR 1406 (22001): Data too long for column 'shell' at row 24 l/ I$ F' i9 _! [; K8 ~
6 x! l  g) c. c. o( W; F
Records: 0  Duplicates: 0  Warnings: 0
9 ]. z! O( d- Z) }. {0 U" H. i; z6 L, V( v
ERROR 1406 (22001): Data too long for column 'shell' at row 2
; h6 N4 b; z0 G$ b+ j2 q6 ~报错提示字符太长,导致数据容量过大。
  f3 p  g7 [( r* R+ e, d解决办法:3 b) D+ ~$ b) i! M$ M) l/ d1 J
modify 修改字段类型' Y7 I' j3 `" R! Z) F* u4 U
    modify 字段名 类型(宽度) 约束条件 , modify 修改个多个在后面田间,modify
# f# _! W8 d6 _: K. Fmysql> alter table six modify shell varchar(50);
1 Y* ]0 c3 N# W) K, P6 U% ]# ~( U' b1 M1 _+ |' r# [0 W
Query OK, 0 rows affected (1.85 sec)# ?9 S. }. W( n! D5 y6 p, N% ?. G
Records: 0  Duplicates: 0  Warnings: 0
4 w/ b4 a8 d/ f; ~% g) ^/ l9 U" e, F9 D/ M7 X
mysql> alter table six modify shell varchar(50);
7 Z" n% u8 C* h0 }7 FQuery OK, 0 rows affected (1.85 sec)
! T- W) \4 u6 W3 D$ ]  Y
/ T+ g; a* L8 P+ q# `% ~/ K' fmysql> load data infile '/etc/passwd' into table gz.six fields terminated by ':' lines terminated by '\n';) m* _& ?8 S3 T) c! C" ?- b
Query OK, 24 rows affected (0.29 sec)$ F# s8 s$ D  E  n0 O( t
Records: 24  Deleted: 0  Skipped: 0  Warnings: 0
5 G3 C( @& J# F% j3 y0 L$ x& ~- g. O/ u/ _$ S: D! m6 O$ ^( @8 G. o; X
 楼主| 发表于 2020-6-17 15:26:47 | 显示全部楼层
mysql> load data infile '/etc/passwd' into table gz.six fields terminated by ':' lines terminated by '\n';  
/ l6 [3 a3 ]" Q2 i" QERROR 1406 (22001): Data too long for column 'shell' at row 2- y' ~, c' i' X; j/ _
mysql> load data infile '/etc/passwd' into table gz.six fields terminated by ':' lines terminated by'\n';
- r% W! e- ]; ?! w0 v3 HERROR 1406 (22001): Data too long for column 'shell' at row 2
, I( x3 n8 E. r; d0 m: }mysql> load data infile '/etc/passwd' into table gz.six fields terminated by ':' lines terminated by '\n';
6 \( W+ X: ?2 ~7 |ERROR 1406 (22001): Data too long for column 'shell' at row 2
# M. ?3 k% d# kmysql> alter table six modify shell varchar(50);
2 M4 L  ?" s& [Query OK, 0 rows affected (1.85 sec)) P0 h$ a( V$ M9 C! P
Records: 0  Duplicates: 0  Warnings: 0" j0 H/ I2 X5 r* p
; P2 A1 m% d- W; F9 z0 h; W5 _# ^7 a
mysql> load data infile '/etc/passwd' into table gz.six fields terminated by ':' lines terminated by '\n';  j9 s9 t/ H- Q0 `
Query OK, 24 rows affected (0.29 sec)
0 v* L% R/ y7 W- \/ x, {Records: 24  Deleted: 0  Skipped: 0  Warnings: 05 W5 H; Q) }. A5 ~
 楼主| 发表于 2020-6-17 17:59:40 | 显示全部楼层
为了避免类似问题再次发生,可以使用定义参数限制条件大一点。
您需要登录后才可以回帖 登录 | 开始注册

本版积分规则

关闭

站长推荐上一条 /4 下一条

北京云银创陇科技有限公司以云计算运维,代码开发

QQ|返回首页|Archiver|小黑屋|易陆发现技术论坛 点击这里给我发消息

GMT+8, 2026-4-8 13:46 , Processed in 0.038977 second(s), 22 queries .

Powered by Discuz! X3.4 Licensed

© 2012-2025 Discuz! Team.

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