对数据表操作之前备份一下是个好习惯

1.备份表结构

create table 备份表名 like 表名;

2.备份表数据

insert into 备份表名 select * from 表名;

3.删除原来主键字段(如id)

alter table 表名 drop id;

4.添加主键,自增,放在第一位

alter table 表名 add id int(11) primary key auto_increment first;

5.检查没问题的话,备份的表可以删了

delete from 备份表名;

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-10
  • 2022-12-23
  • 2021-08-11
  • 2022-12-23
猜你喜欢
  • 2021-05-26
  • 2022-12-23
  • 2021-08-16
  • 2022-03-07
相关资源
相似解决方案