So a website that I've inherited had the AUTO_INCREMENT value for a particular table set to a value of 65536. The website is an online store, and this particular table is set for product variations. Well, we've finally hit 65,536 variations and cannot add anymore. I'm now getting an error of Duplicate entry '65535' for key 'PRIMARY'

I've found where to increase this value in phpMyAdmin, but I still get the same error. Is there something I'm doing wrong? Any advice would be mucho helpful.

phpMyAdmin Operations screenshot

1 Answer 1


If your auto increment column is of type UNSIGNED SMALLINT, then you'll have the 65535 limit. Changing the column type to like UNSIGNED INT should allow you up to 4294967295. You can use UNSIGNED BIGINT if you need anything bigger.

If this does not solve your problem, can you post your table structure, which you can get with the statement: show create table <table name>

  • Ah, I see! In the structure column it is set to SMALLINT. I'll change it and let you know if that works! Thank you so much for the response!
    – user370136
    Aug 12, 2016 at 2:06
  • Yes, that was exactly the problem. Reset it to UNSIGNED BIGINT and it's working just fine now. Thank you!
    – user370136
    Aug 12, 2016 at 18:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.