MySQL Tutorial/Miscellaneous Functions/INET ATON
INET_ATON() also understands short-form IP addresses
mysql>
mysql> SELECT INET_ATON("127.0.0.1"), INET_ATON("127.1");
+------------------------+--------------------+
| INET_ATON("127.0.0.1") | INET_ATON("127.1") |
+------------------------+--------------------+
| 2130706433 | 2130706433 |
+------------------------+--------------------+
1 row in set (0.00 sec)
mysql>
INET_ATON(expr): Given a network address, returns an integer that represents the numeric value of the address.
The generated number is always in network byte order.
The number is calculated as 68*256^3 + 207*256^2 + 224*256 + 40.
mysql>
mysql> SELECT INET_ATON("68.207.224.40");
+----------------------------+
| INET_ATON("68.207.224.40") |
+----------------------------+
| 1154474024 |
+----------------------------+
1 row in set (0.00 sec)
mysql>
mysql>