MySQL设置自增初始值和步长

SHOW VARIABLES LIKE 'auto_inc%'; 查看当前数据库的自增长设置。

SET @@auto_increment_increment=3

alter table `test`add id BIGINT; -- 为test表增加一个名称为id,类型为bigint的列.

alter table `test` change id id BIGINT not null auto_increment primary key; -- 将id列设置为主键并且自增.

 

posted @ 2023-05-22 15:07  忧伤恋上了快乐  阅读(292)  评论(0编辑  收藏  举报