开发者

PHPAdmin database negative primary key

开发者 https://www.devze.com 2023-03-24 00:32 出处:网络
I am facing a probl开发者_运维问答em with my phpadmin database. My primary key for a table got negative and I can\'t see where the problem lies. I set the primary key as INT 20, auto increment 1. The

I am facing a probl开发者_运维问答em with my phpadmin database. My primary key for a table got negative and I can't see where the problem lies. I set the primary key as INT 20, auto increment 1. The negative integer is not a small number


By default MySQL stores your INT(20) as unsigned integer on 4 bytes: INT(4). This means you have a range between -2147483648 and 2147483647 and probably you're overflowing to negative values. Using unsigned gives you a range between 0 and 4294967295. You should consider using BIGINT(8). See the documentation on numeric types and how MySQL handles overflow!

0

精彩评论

暂无评论...
验证码 换一张
取 消