GET 24/7 LIVE HELP NOW

Announcement

Announcement Module
Collapse
No announcement yet.

Auto Increment error

Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Auto Increment error

    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.

  • #2
    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

    Comment

    Working...
    X