Auto increment ID value

1

In my MySQL Workbench I have 4 tables with the auto increment id.

But when I fill in the form it adds non-consecutive values.

For example:

I fill in a form for the first time and the ID it puts me is 3.

I want the Id to be followed. Is there any way to get around or fix this?

    
asked by anonymous 12.02.2014 / 12:28

2 answers

3

You can also change the value of the property if you have lost the string if you have removed a record.

ALTER TABLE 'TABELA' AUTO_INCREMENT = ?;

No ? you replace for whatever value you wish.

If you need the data you do not need to do the truncate, this will solve it.

    
12.02.2014 / 12:44
2

Give a truncate to the table, it will reset the auto-increment.

Note: If your table has records you do not want to lose, make a backup before:

TRUNCATE [TABLE] tbl_name

More on MySQL documentation

    
12.02.2014 / 12:34