Lmxc
Lmxc

Reputation: 283

auto increment not starting from 1

I am inserting some data to a database and I have an id column which has auto increment. I updated my xampp server yesterday and now the auto increment is starting from 4, 3, 5 in different tables. It used to work fine before. I did not delete any rows from the table it just starts from those numbers. What is wrong?

Upvotes: 5

Views: 17323

Answers (5)

Michel de Ruiter
Michel de Ruiter

Reputation: 7954

This can be a consequence of using a Galera cluster. By default, it will automatically adjust the auto_increment_increment and auto_increment_offset variables according to the size of the cluster, and when the cluster size changes. This avoids replication conflicts due to auto_increment.

The short answer is not to depend on auto_increment numbers being subsequent, without gaps.

Upvotes: 0

If you really want to reset this, in phpMyAdmin, open this table, go to Operations and change the value for AUTO_INCREMENT.----- this is working for me, i have just done this,

Upvotes: 0

Sahnosh Rahguzar
Sahnosh Rahguzar

Reputation: 349

You can reset your auto increment ID from the following Command:

ALTER TABLE TABLE_NAME AUTO_INCREMENT = 1;

This will start from 1.

OR
go to LOCALHOST/PHPMYADMIN enter:

select your DB

after choose the specific table than go to Operations an set a number to the Auto increment.

Upvotes: 1

Sobin Augustine
Sobin Augustine

Reputation: 3765

ALTER TABLE tablename AUTO_INCREMENT = 1

This will reset your auto increment to start from 1

Upvotes: 5

Marc Delisle
Marc Delisle

Reputation: 9012

If you really want to reset this, in phpMyAdmin, open this table, go to Operations and change the value for AUTO_INCREMENT.

Upvotes: 3

Related Questions