1. 程式人生 > >mysql報ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must

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

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)