What is the limit of auto_increment (integer) in mysql

∥☆過路亽.° 提交于 2020-01-11 18:51:33

问题


I have a mysql database in which i am using auto_increment(integer), can you tell me till what integer it can incremented. How we can increase the limit of auto_increment?


回答1:


The limit of an auto_increment column is the size of the column:

Use a large enough integer data type for the AUTO_INCREMENT column to hold the maximum sequence value you will need. When the column reaches the upper limit of the data type, the next attempt to generate a sequence number fails. For example, if you use TINYINT, the maximum permissible sequence number is 127. For TINYINT UNSIGNED, the maximum is 255.

The limits of the integer types are:

TINYINT            - 127
UNSIGNED TINYINT   - 255
SMALLINT           - 32767
UNSIGNED SMALLINT  - 65535
MEDIUMINT          - 8388607
UNSIGNED MEDIUMINT - 16777215
INT                - 2147483647
UNSIGNED INT       - 4294967295
BIGINT             - 9223372036854775807
UNSIGNED BIGINT    - 18446744073709551615



回答2:


Integer can go as high as 2147483647. If unsigned it can be 4294967295.

See this chart for all of the integer values.



来源:https://stackoverflow.com/questions/11264447/what-is-the-limit-of-auto-increment-integer-in-mysql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!