I searched for an answer for this question...I couldn't find it...sorry if I'm replicating.

What I need to do (or at least would like to be able to do) is reset the auto_increment back to "0" on a column which is used for a User ID (userID).

Is there a quick way to do this (i.e. sql command)?

I have deleted ALL rows from my table and when I go to add a new row (to the empty table) the auto_increment value does not return to "0". My column userID gets set to what the next auto_increment would have been before I deleted all the rows.

How do I get MySQL to move return to "0"?

Thank you ahead of time for any useful help.

    I'm not sure on how to reset the auto_increment.

    Anyway, since you have deleted all of the records, why don't you drop the table and start all over again??? 🙂
    Sorry for giving such an extreme solution. In fact, it's easier.

      After much looking I found the correct sql statement to reset counter to the next current max value...without having to drop and recreate the table 🙂

      ALTER TABLE tbl_name AUTO_INCREMENT = 1;


      The last place you look is always where you find what you need.

        Write a Reply...