ERROR 1075 (42000): Incorrect table definition; there can be only one auto colum n and it must be defined as a key

ERROR 1075 (42000): Incorrect table definition; there can be only one auto colum n and it must be defined as a key

发布者:IT人在线 | 发表时间:2018/12/12 9:56:22

在创建表和字段时,我们执行下面的sql出现错误

 

 create table s_user(id int auto_increment,name varchar(10),mobile varchar(10));

ERROR 1075 (42000): Incorrect table definition; there can be only one auto colum

n and it must be defined as a key
ERROR 1075(42000):表定义不正确;只能有一个自动列,它必须定义为key
 
自增列只能有1列, 且这列必须为key
因些我们要设置主键  primary key

 create table s_user(id int auto_increment primary key,name varchar(10),mobile varchar(10));

 
这样就没问题了。