跳到主要内容
版本: 最新版本-3.5

inet_aton

接受一个包含 A.B.C.D 格式的 IPv4 地址的字符串。返回一个 BIGINT 数字,表示大端字节序中对应的 IPv4 地址。

语法

BIGINT inet_aton(VARCHAR ipv4)

示例

mysql> select inet_aton('192.168.1.1'); 
+--------------------------------------+
| inet_aton('192.168.1.1') |
+--------------------------------------+
| 3232235777 |
+--------------------------------------+

mysql> select stringIp, inet_aton(stringIp) from ipv4;
+-----------------+----------------------------+
|stringIp | inet_aton(stringIp) |
+-----------------+----------------------------+
| 0.0.0.0 | 0 |
| 255.255.255.255 | 4294967295 |
| invalid | NULL |
+-----------------+----------------------------+

关键词

INET_ATON