【发布时间】:2012-07-01 03:24:48
【问题描述】:
我有一个 mysql 数据库,我在其中使用 auto_increment(integer),你能告诉我它可以递增到什么整数。如何增加 auto_increment 的限制?
【问题讨论】:
标签: mysql integer auto-increment
我有一个 mysql 数据库,我在其中使用 auto_increment(integer),你能告诉我它可以递增到什么整数。如何增加 auto_increment 的限制?
【问题讨论】:
标签: mysql integer auto-increment
auto_increment 列 is the size of the column 的限制:
为 AUTO_INCREMENT 列使用足够大的整数数据类型来保存您需要的最大序列值。当列达到数据类型的上限时,下一次生成序列号的尝试失败。例如,如果您使用 TINYINT,则允许的最大序列号为 127。对于 TINYINT UNSIGNED,最大为 255。
limits of the integer types 是:
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
【讨论】:
整数可以高达 2147483647。如果未签名,则可以是 4294967295。
See this chart 用于所有整数值。
【讨论】: