# Auto Increment error

**URL:** <https://forums.percona.com/t/auto-increment-error/928>\
**Category:** Other MySQL® Questions\
**Created:** [September 15, 2008, 8:18am UTC](https://forums.percona.com/t/auto-increment-error/928 "2008-09-15T08:18:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pato](https://avatars.discourse-cdn.com/v4/letter/p/f6c823/32.png) [@Pato](https://forums.percona.com/u/Pato)\
**Post date:** [September 15, 2008, 8:18am UTC](https://forums.percona.com/t/auto-increment-error/928/1 "2008-09-15T08:18:39Z")

</div>

Hallo,

I have a mysql database with about 180 tables. After setting up the db, I get the following error when trying to populate some of the tables with an auto increment primary key

Database Error: Duplicate entry ‘0’ for key 1

If I alter the affected table and set auto increment to one i can only insert one record and an attempt to insert a second record gives the above error. All my tables are in Innodb engine.

Any help will be appreciated.

---

<div class="post-metadata">

**Author:** ![BargainPredator](https://avatars.discourse-cdn.com/v4/letter/b/3ec8ea/32.png) [@BargainPredator](https://forums.percona.com/u/BargainPredator)\
**Post date:** [September 26, 2008, 6:04pm UTC](https://forums.percona.com/t/auto-increment-error/928/2 "2008-09-26T18:04:54Z")

</div>

You may have added manualy a row in the table wich is above the value of the AUTO\_INCREMENT of your column.

You can modify the start of the auto-incremention :

ALTER TABLE tbl AUTO\_INCREMENT = 100;

If not be sure your auto-incremented column is you primary key column
