解决,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为主键并设为自增后,保存成功,问题解决。

原文地址:https://www.cnblogs.com/guodongdidi/p/6290782.html