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

1. mysql> select inet_aton('192.168.0.1');
2. +-------------------------------------------+
3. | ipv4_string_to_num_or_null('192.168.0.1') |
4. +-------------------------------------------+
5. | 3232235521                                |
6. +-------------------------------------------+
7. 1 row in set (0.01 sec)

9. mysql> SELECT inet_aton('192.168');
10. +---------------------------------------+
11. | ipv4_string_to_num_or_null('192.168') |
12. +---------------------------------------+
13. | NULL                                  |
14. +---------------------------------------+
15. 1 row in set (0.01 sec)

keywords

INET_ATON, IP