当MySQL中有数据的时候不能新增主键,利用trancate把表中的数据清空(其原理为先删除表再新建表结构)
truncate stu;
alter table stu add id int primary key first;
修改字段位置字段名后需要加上数据类型,after后要加上字段。