AUTO_INCREMENT MySQL problem

0

I had a problem that from ID 35218, the accounts started to be inserted from ID 400000, but I do not remember having tampered with the value of AUTO_INCREMENT. What can I do to get the accounts back to the lowest empty ID?

    
asked by anonymous 09.10.2018 / 02:43

1 answer

3

First of all, you should check if there is any problem with your insertion, using an exception block, when you try to insert something and an error occurs, even though the sequence changes, you can modify the auto_increment sequence of the your table using the code:

ALTER TABLE nome_da_tabela AUTO_INCREMENT = 352019;

The problem is that if you do this will reach a point where it will reach the number: 400000, and if the field is a primary key you will have problems as it is violating a unique key.

    
09.10.2018 / 03:11