骄傲嘚少年 2019-06-01 15:16 采纳率: 0%
浏览 2393

小白求问 怎么解决 ERROR 1406 (22001): Data too long for column 'gender' at row 1!

Last login: Sat Jun 1 11:44:42 on ttys000
bianshuaideMacBook-Pro:~ bianshuai$ mysql --default-character-set=gbk -uroot -proot
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.7.25 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> -- 1、创建数据库jt_db数据库(如果不存在才创建)
mysql> create database if not exists jt_db charset utf8;
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> use jt_db; -- 选择jt_db数据库
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> -- 2、在 jt_db 库中创建 stu 表(学生表)
mysql> drop table if exists stu;
Query OK, 0 rows affected (0.00 sec)

mysql> create table stu(
-> stuid varchar(50),
-> name varchar(50),
-> gender char(4),
-> addr varchar(50),
-> score double
-> );
Query OK, 0 rows affected (0.01 sec)

mysql> insert into stu values("1001",'张三','男', '北京', 86);
ERROR 1406 (22001): Data too long for column 'gender' at row 1图片说明

  • 写回答

2条回答 默认 最新

  • threenewbee 2019-06-01 15:18
    关注

    试试看英文是否能插入
    或者把建表里 gender char(4) 修改为 gender varchar(4)
    (先执行drop table stu)

    评论

报告相同问题?

悬赏问题

  • ¥15 Qt下使用tcp获取数据的详细操作
  • ¥15 idea右下角设置编码是灰色的
  • ¥15 全志H618ROM新增分区
  • ¥15 在grasshopper里DrawViewportWires更改预览后,禁用电池仍然显示
  • ¥15 NAO机器人的录音程序保存问题
  • ¥15 C#读写EXCEL文件,不同编译
  • ¥15 MapReduce结果输出到HBase,一直连接不上MySQL
  • ¥15 扩散模型sd.webui使用时报错“Nonetype”
  • ¥15 stm32流水灯+呼吸灯+外部中断按键
  • ¥15 将二维数组,按照假设的规定,如0/1/0 == "4",把对应列位置写成一个字符并打印输出该字符