Tag Archives: 1062 – Duplicate entry ’2147483647′ for key 1

Error 1062 – Duplicate entry ’2147483647′ for key 1

CRE Loaded was giving me the error  1062 – Duplicate entry ’2147483647′ for key 1 – when trying to add a new product.

Cause: for some unexplained reason the auto_increment ID field on Table “products” has gone up to 2147483647 which is apparently the maximum number of rows permitted in an INT column.

Fix:

  1. Go to your phpMyadmin interface
  2. Backup your database (make sure you know how to restore it if needed)
  3. Browse the products table (select to sort the fields by Descending order)
  4. The top item should now have the ID = 2147483647
  5. Change the ID to a number up from the previous item (e.g.: Previous was ID = 301, than change the ID = 2147483647 to 302)
  6. Repeat same process with table “product_to_categories”
  7. Return to table “products”
  8. Select the SQL tab
  9. run the following SQL Query :  ALTER TABLE products AUTO_INCREMENT=303   (note that 303 is the next number up from the example on step 5, you should use the next number up in your situation)

It worked perfectly for me, hope this helps.

Technorati Tags: , , , ,