解决,Incorrect table definition; there can be only one auto column and it must be defined as a key

今天在迁移项目时,操作数据库报错:

Incorrect table definition; there can be only one auto column and it must be defined as a key

我用的是Navicat Premium,而检测表中其他字段发现,并没有另一个设为自增的字段,很是费解,最后在stackoverflow找到这样的答案:

 

意思是:设为自增的字段必须是主键,而我用的是客户端,表是批量从SQLServer复制到MySQL的,导致最后MySQL表中主键丢失,设置id为主键并设为自增后,保存成功,问题解决。

posted @ 2017-01-16 19:03  果冻迪迪  阅读(125746)  评论(0编辑  收藏  举报