alter table (表名) add primary key(id); -----设置主键 alter table (表名) modify id int auto_increment; --------设置自动增长