有时需要对mysql中设为auto_increment发的字段进行重置,因此总结了一下,大概有三种方式可以做到:

1、直接重置autoIncrement的值

ALTER TABLE table_name AUTO_INCREMENT = 1;

2、通过truncate table 完成

TRUNCATE TABLE table_name;

3、删除表,然后重建表

DROP TABLE table_name;
CREATE TABLE table_name { ... };

 

相关文章:

  • 2022-12-23
  • 2022-02-19
  • 2022-12-23
  • 2022-01-15
  • 2022-12-23
  • 2021-10-20
猜你喜欢
  • 2022-01-01
  • 2022-12-23
  • 2021-10-20
  • 2021-10-20
相关资源
相似解决方案