INET_ATON

2024-04-19 08:42:50  Updated

Syntax

INET_ATON(expr)

Purpose

INET_ATON() converts an IPv4 network address into a string and returns an integer to indicate the address value in big-endian network order. It returns NULL if the argument is invalid.

Notice

Store the values generated by the INET_ATON() function in an INT UNSIGNED column rather than a signed INT column. If you use a signed column, when the IP address of the first octet is greater than 127, the corresponding value cannot be correctly stored.

Examples

obclient> SELECT INET_ATON('1.1.1.1');
+----------------------+
|  INET_ATON('1.1.1.1')|
+----------------------+
|             16843009 |
+----------------------+
1 row in set

Contact Us