mysql中auto_increment(整数)的限制是多少

时间:2021-12-31 01:28:01

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?

我有一个mysql数据库,我在其中使用auto_increment(整数),你能告诉我,直到它可以递增的整数。我们如何才能增加auto_increment的限制?

2 个解决方案

#1


41  

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

auto_increment列的限制是列的大小:

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.

对AUTO_INCREMENT列使用足够大的整数数据类型来保存所需的最大序列值。当列达到数据类型的上限时,下一次生成序列号的尝试将失败。例如,如果使用TINYINT,则允许的最大序列号为127.对于TINYINT UNSIGNED,最大值为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


5  

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

整数可以高达2147483647.如果未签名,则可以是4294967295。

See this chart for all of the integer values.

有关所有整数值,请参见此图表。

#1


41  

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

auto_increment列的限制是列的大小:

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.

对AUTO_INCREMENT列使用足够大的整数数据类型来保存所需的最大序列值。当列达到数据类型的上限时,下一次生成序列号的尝试将失败。例如,如果使用TINYINT,则允许的最大序列号为127.对于TINYINT UNSIGNED,最大值为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


5  

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

整数可以高达2147483647.如果未签名,则可以是4294967295。

See this chart for all of the integer values.

有关所有整数值,请参见此图表。