mysql报ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must

来源:互联网 发布:win10 linux安装教程 编辑:程序博客网 时间:2024/06/06 00:51

mysql在建表时报故障ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must be defined as a key

  create table ll(
    -> id int(5) not null auto_increment,
    -> name varchar(10),
    -> age int(10));
ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must be defined as a key

原因:在设置了自增长列以后需要定义主键列,否则报错

添加主键,修改后成功:

 create table ll(
    -> id int(5) not null auto_increment,
    -> name varchar(10),
    -> primary key(id));
Query OK, 0 rows affected (0.81 sec)


阅读全文
0 0
原创粉丝点击