Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
MySQL 文档说:数据类型 VARBINARY(16) 用于 IPv6 地址,数据类型 VARBINARY(4) 用于 IPv4 地址。
但是当我尝试将 INET_ATON 结果存储到 VARBINARY(4) 列时,我收到以下错误消息:
Data too long for column varbinary(4)
将 INET_ATON 结果存储到 VARBINARY(16) 是可以的!
怎么了?
从所说INET_ATON的文档中:
INET_ATON
要存储由 生成的值INET_ATON(),请使用INT UNSIGNED列 (...)
INET_ATON()
INT UNSIGNED