• Reset the auto increment value for a MySQL table

    If you want to reset the auto increment value of a MySQL auto incremental primary key to a new value for your table either higher or lower than what it would otherwise next be.

    Suppose that you want to begin the next time you insert a record into this table the value of the auto incremental primary key will be 5000 .

    Note :If the highest value for the column is already greater than 5000 then it will be set to the highest value plus 1.

    ALTER TABLE table_name AUTO_INCREMENT = 5000

    If you want to do that from PhpMyadmin ,all of what you need to do is :

    1. select DataBase.
    2. select table.
    3. click the “Operations” tab .
    4. Enter the auto_increment new value and press on Go button.

    Note that the Auto_increment value will be equal to the Max number for the primary key + 1 ,if there is a value higher than the one you have specified for auto_increment.




    Categories: Mysql

    Comments are currently closed.