mysql插入数据 报错[Err] 1136 - Column count doesn't match

时间:2022-05-09 04:01:43

版本:8.0.16

创建了一张表:create table user_table(
uid int primary key auto_increment,
uname varchar(10)
)auto_increment=1

插入数据报错:mysql插入数据 报错[Err] 1136 - Column count doesn't match

 

经查找 ,有三种方式可以解决这个问题:

1.插入数据得时候,带入列名:

insert into user_table("uname") values ("刘一")

2.自增键这列设置为0

insert into user_table values(0,"刘二")

3.自增键这列设置为null

insert into user_table values(null,"刘三")

结果:mysql插入数据 报错[Err] 1136 - Column count doesn't match