MySQL INET_ATON() Function
In MySQL, the INET_ATON() function converts the specified IP address in a.b.c.d form to a numeric IP in network byte order.
The INET_ATON() function is the inverse of the INET_NTOA() function.
INET_ATON() Syntax
Here is the syntax of the MySQL INET_ATON() function:
INET_ATON(ip)
Parameters
ip- Required. An IPv4 address in
a.b.c.dform .
Return value
The MySQL INET_ATON() function converts the specified IP address in a.b.c.d form to a numeric IP in network byte order.
For a ip a.b.c.d, the algorithm of the MySQL INET_ATON() function is:
a × 256 × 256 × 256
+ b × 256 × 256
+ c × 256
+ dIf the argument is NULL, the function will return NULL.
INET_ATON() Examples
Here is a common examples of INET_ATON().
SELECT INET_ATON('192.168.1.100');
+----------------------------+
| INET_ATON('192.168.1.100') |
+----------------------------+
| 3232235876 |
+----------------------------+