First we need to cancel the auto-increment and primary key of id. The following
code takes the id column in the water table as an example.
alter table water
modify id int not null;
alter table water
drop primary key;
Then regenerate the id column
set @i=0;
update water set water.id=(@i:=@i+1);
The next step is to reset it to primary key + auto-increment
alter table water
add primary key (id);
alter table water
modify id int auto_increment;
successfully solved