如何修复“为列调整的值超出范围"错误?

2022-01-24 00:00:00 range mysql

我进入 phpMyAdmin 并将整数 (15) 字段的值更改为 10 位数字,因此一切正常.我输入了值4085628851"并收到以下错误:

I went into phpMyAdmin and changed the value for an integer(15)field to a 10-digit number, so everything should work fine. I entered the value '4085628851' and I am receiving the following error:

警告:#1264 超出范围值针对第 1 行的电话"列进行了调整

Warning: #1264 Out of range value adjusted for column 'phone' at row 1

然后将值更改为2147483647".

It then changes the value to '2147483647'.

经过一番谷歌搜索,我发现这篇文章解释了如何解决这个问题.http://webomania.wordpress.com/2006/10/01/out-of-range-value-adjusted-for-column-error/,但我不知道如何登录 Mysql shell.

After some googling, I found this article that explains how to fix the problem. http://webomania.wordpress.com/2006/10/01/out-of-range-value-adjusted-for-column-error/, but I don't know how to login to the Mysql shell.

如何登录 Mysql shell?如何解决此错误?

How do I login to the Mysql shell? How do I fix this error?

推荐答案

您尝试设置的值对于带符号的 INT 字段来说太大.显示宽度(15)不影响可存储值的范围,只影响值的显示方式.

The value you were trying to set is too large for a signed INT field. The display width (15) does not affect the range of values that can be stored, only how the value is displayed.

参考:关于数字的 MySQL 文档

关于电话号码 - 请参阅 以某种规范格式存储电话号码还是按输入"存储电话号码更好?

On phone numbers - see Is it better to store telephone numbers in some canonical format or "as entered"?

相关文章