找回密码
 注册
查看: 3090|回复: 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" y- k* h6 i7 [. m# ^
ERROR 1406 (22001): Data too long for column 'shell' at row 25 h5 H1 {* g' }* ^! Z

5 D6 C9 ?' Q% T0 u; y* r6 @, J" C1 P, I8 N7 \* b4 R
mysql> load data infile '/etc/passwd' into table gz.six fields terminated by ':' lines terminated by '\n';
; i8 X- h4 X- [2 [7 m- D5 W2 i/ ^ERROR 1406 (22001): Data too long for column 'shell' at row 2! ~7 h4 p8 w/ M$ D0 L1 j

; N+ \! ~/ `2 T9 \- nRecords: 0  Duplicates: 0  Warnings: 0* V  ~1 D# k6 \/ _

  E& q4 o$ x" xERROR 1406 (22001): Data too long for column 'shell' at row 2
$ Z: e: u( n0 J& Z2 D4 t( L报错提示字符太长,导致数据容量过大。& n4 m# g# Y! j  T0 ?
解决办法:
2 P$ Q2 z: t+ `7 D# vmodify 修改字段类型
$ E! i. v6 `- n7 A4 ^( |5 ?+ t( w    modify 字段名 类型(宽度) 约束条件 , modify 修改个多个在后面田间,modify
1 F2 @2 ]! w4 a3 c1 ~mysql> alter table six modify shell varchar(50);
5 U/ G( ~; C- M( L9 b4 ~5 R
2 _# w4 c- q0 C6 u* z7 H$ Z4 ?Query OK, 0 rows affected (1.85 sec)3 [: O3 g" S0 [/ v; d
Records: 0  Duplicates: 0  Warnings: 08 Z& A  m# y% ]9 I4 }/ [

" W6 J" Z, J- S! ~5 T' d' B; Xmysql> alter table six modify shell varchar(50);6 m! s6 R" W9 z3 H/ O
Query OK, 0 rows affected (1.85 sec)
/ U  v0 V: ?4 Y8 L& o# q1 o! `9 i  ^; s! j* r# j# ^1 Z* g+ F: ?
mysql> load data infile '/etc/passwd' into table gz.six fields terminated by ':' lines terminated by '\n';
/ p6 ?2 B4 @; M! i$ gQuery OK, 24 rows affected (0.29 sec)7 @/ g% q$ B8 d2 L
Records: 24  Deleted: 0  Skipped: 0  Warnings: 0
  `( i, x1 z" Q, z6 r2 U  d% c0 k1 M

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';  4 @2 M' L/ }( p4 ]" U
ERROR 1406 (22001): Data too long for column 'shell' at row 2
$ P8 |- p; v' |5 Zmysql> load data infile '/etc/passwd' into table gz.six fields terminated by ':' lines terminated by'\n';+ g- b& s- G' U3 d5 p% Z- _# x
ERROR 1406 (22001): Data too long for column 'shell' at row 2
6 b6 y4 k/ x4 rmysql> load data infile '/etc/passwd' into table gz.six fields terminated by ':' lines terminated by '\n';
$ r% I2 X. S, ~" a% I; sERROR 1406 (22001): Data too long for column 'shell' at row 2. O6 j$ Y5 s% |8 f" f
mysql> alter table six modify shell varchar(50);
2 x; c+ k' ?! ^" iQuery OK, 0 rows affected (1.85 sec)
4 [1 u; ?# \0 N) y3 v2 H& @% ?3 aRecords: 0  Duplicates: 0  Warnings: 0% E  Q$ K3 V% J& P: p
. F2 k5 n9 A3 J# i2 w% i
mysql> load data infile '/etc/passwd' into table gz.six fields terminated by ':' lines terminated by '\n';
, k( m( {6 f: e4 z: L1 FQuery OK, 24 rows affected (0.29 sec)
- ]5 ^! m: G1 A4 u9 Y( q1 y) [; @Records: 24  Deleted: 0  Skipped: 0  Warnings: 0
( E2 h- Q  F! O# u8 N* }6 R# `

1

主题

0

回帖

12

积分

管理员

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

本版积分规则

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

GMT+8, 2026-6-12 02:38 , Processed in 0.017723 second(s), 22 queries .

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

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