
一、不清空数据
无外键约束:
1、删除原有主键
alter table '表名' drop 'id';
2、添加新主键字段并设置主键
alter table '表名' add 'id' int(8) primary key not null auto_increment first;
有外键约束
1、删除外键关系
alter table test1(外键表) drop foreign key test1_ibfk_1(外键名);
2、删除主键字段
alter table test(主键表) drop '...