mysql 的自增字段只能是主键,如果原表已经有主键,需要设置自增字段应该怎么做呢?


1、alter table bu_staff  drop primary key;  先删除表的主键  id为原表主键


2、alter table bu_staff  add primary key (face_id,id);  增加face_id为第一主键


3、alter table bu_staff  modify face_id int(11)  auto_increment;给face_id 增加auto_increment 属性


4、alter table bu_staff  auto_increment=10000;    给自增值设置初始值

相关文章:

  • 2021-06-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-17
  • 2022-12-23
  • 2022-01-12
  • 2021-06-19
  • 2021-12-10
  • 2022-12-23
  • 2021-10-11
相关资源
相似解决方案