Home » Blog » MySQL Error Duplicate entry for ‘32767’ key ‘PRIMARY’

MySQL Error Duplicate entry for ‘32767’ key ‘PRIMARY’

Have you ever got this error in one of your PHP scripts?

MySQL Error: Duplicate entry ‘32767’ for key ‘PRIMARY’

It’s because the number rows exceeds Maximum Value for that table’s key’s integer type. See the table below. The Fix? Just change your key’s integer type.

MySQL supports the SQL standard integer types INTEGER (or INT) and SMALLINT. As an extension to the standard, MySQL also supports the integer types TINYINT, MEDIUMINT, and BIGINT. The following table shows the required storage and range for each integer type.

MySQL Error duplicate entry '32767' for key 'primary'
Integer Types (Exact Value) – INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT

More info about MySQL’s Numeric Types

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.