Skip to main content
Skip to main content

INET_ATON

INET_ATON​

SinceVersion dev

inet_aton

description​

Syntax​

BIGINT INET_ATON(VARCHAR ipv4_string)

Takes a string containing an IPv4 address in the format A.B.C.D (dot-separated numbers in decimal form). Returns a BIGINT number representing the corresponding IPv4 address in big endian.

notice​

It is the alias of ipv4_string_to_num_or_null. It will return NULL if the input string is not a valid IP address or NULL, which is the same with MySQL

example​

mysql> select inet_aton('192.168.0.1'); 
+-------------------------------------------+
| ipv4_string_to_num_or_null('192.168.0.1') |
+-------------------------------------------+
| 3232235521 |
+-------------------------------------------+
1 row in set (0.01 sec)

mysql> SELECT inet_aton('192.168');
+---------------------------------------+
| ipv4_string_to_num_or_null('192.168') |
+---------------------------------------+
| NULL |
+---------------------------------------+
1 row in set (0.01 sec)

keywords​

INET_ATON, IP