思路:首先把字段设置为key,然后更改为自增;例如:alter table asynch_task ADD KEY comp_index (code);alter table asynch_task modify code BIGINT(20) auto_increment;