首页 小组 问答 话题 好文 素材 用户 唠叨 我的社区

[Mysql]mysql重建主键ID

九秘Lv.1种子选手
2024-10-15 14:53:42
0
8


删除原有ID列:

alter table order_shbk drop id;

重建ID列,现在ID全部为0

alter table order_shbk add id int(11) not null first;

设置ID主键自增:

alter table order_shbk modify column id int( 11 ) not null auto_increment,add primary key(id);

alter table order_shbk drop id;alter table order_shbk add id int(11) not null first;alter table order_shbk modify column id int( 11 ) not null auto_increment,add primary key(id);
九秘
九秘

7 天前

签名 : 我常驻在>https://www.huaqu.club/ask   8       0
评论
站长交流