Auto-increment is not resetting in MySQL

后端 未结 8 1463
花落未央
花落未央 2020-12-03 17:53

I am trying to set up a script to generate a particular set of test data into my database, at the beginning of which I want to clear the tables concerned without dropping co

8条回答
  •  隐瞒了意图╮
    2020-12-03 18:05

    In non-problematic circumstances you can do

    ALTER TABLE tbl AUTO_INCREMENT = 0;
    

    which brings auto_increment value to the lowest allowed at the time.

提交回复
热议问题