mysql中auto_increment(整数)的限制是多少 [英] What is the limit of auto_increment (integer) in mysql

查看:483
本文介绍了mysql中auto_increment(整数)的限制是多少的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个mysql数据库,其中正在使用auto_increment(integer),您能告诉我直到它可以增加什么整数.如何增加auto_increment的限制?

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?

推荐答案

auto_increment列的限制

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

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.

整数类型的限制是:

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

这篇关于mysql中auto_increment(整数)的限制是多少的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆