【发布时间】:2013-01-23 01:59:05
【问题描述】:
我有一个预先存在的表,其中包含“fname”、“lname”、“email”、“password”和“ip”。但现在我想要一个自动增量列。但是,当我输入时:
ALTER TABLE users
ADD id int NOT NULL AUTO_INCREMENT
我得到以下信息:
#1075 - Incorrect table definition; there can be only one auto column and it must be defined as a key
有什么建议吗?:)
【问题讨论】:
-
你能发布你现有的表定义吗?
-
请发布
describe users的输出 -
试过了,但它只是返回表格。你需要什么?
-
@CharlesJenkins 你能选择正确的答案吗?
-
MODIFY 也可以用作: ALTER TABLE users MODIFY id int NOT NULL AUTO_INCREMENT ; /* 2019 年 8 月 */
标签: mysql sql definition auto-increment