Given a "point address" (such as 127.0.0.1) for a network address as a string, returns an integer representing the value of the address. The address can be either a 4 or a 8-bit address.
mysql> SELECT Inet_aton (' 209.207.224.40 ');
3520061480
The resulting numbers always follow the network byte order. As the example above, the numbers are calculated according to 209x2563 + 207x2562 + 224x256 + 40.
Inet_aton () can also understand short format IP addresses:
mysql> SELECT Inet_aton (' 127.0.0.1 '), Inet_aton (' 127.1 ');
--2130706433, 2130706433
Note: When storing values produced by Inet_aton (), it is recommended that you use the INT UNSIGNED column. If you use the (signed) int column, the corresponding first eight-bit group of IP address values greater than 127 will be up to 2147483647 (that is, the value returned by Inet_aton (' 127.255.255.255 ')).
* INET_NTOA (expr)
Given a digital network address (4 or 8 bits), returns the representation of the address as a string.
*
Mysql> SELECT Inet_ntoa (3520061480);
' 209.207.224.40 '
Transferred from: http://www.rocing.cn/?action=show&id=233
MySQL IP processing functions inet_aton () and Inet_ntoa ()