Skip to main content
Version: V1.0.0

INET_ATON

Declaration

INET_ATON(expr)

Description

Converts an IPv4 network address from string to integer format, where the integer is in network byte order (big-endian). Returns NULL if the parameter is invalid.

tip

Use INT UNSIGNED columns to store values generated by INET_ATON(). Do not use signed INT columns. If you use a signed column, values corresponding to IP addresses with the first octet greater than 127 cannot be stored correctly.

Examples

SELECT INET_ATON('1.1.1.1');
+----------------------+
| INET_ATON('1.1.1.1') |
+----------------------+
| 16843009 |
+----------------------+
1 row in set (0.001 sec)