1,删除原有主键:
ALTER TABLE `table_name` DROP `id`;
2,添加新主键字段:
ALTER TABLE `table_name` ADD `id` int NOT NULL FIRST;
3,设置新主键:
ALTER TABLE `table_name` MODIFY COLUMN `id` int NOT NULL AUTO_INCREMENT,ADD PRIMARY KEY(id);
1,删除原有主键:
ALTER TABLE `table_name` DROP `id`;
2,添加新主键字段:
ALTER TABLE `table_name` ADD `id` int NOT NULL FIRST;
3,设置新主键:
ALTER TABLE `table_name` MODIFY COLUMN `id` int NOT NULL AUTO_INCREMENT,ADD PRIMARY KEY(id);