MySQL给已存在的主键字段设置自增

mysql 给已存在的主键字段设置自增

我的博客:https://blog.itwk.cc

第一步:给 id 增加auto_increment 属性

alter table tablename modify id int(11) auto_increment;

第二步:给自增值设置初始值

alter table tablename auto_increment=10000;

你可能感兴趣的:(Linux,mysql,数据库,sql)