Internet Protocol address is a special kind of data. This data
does not correspond directly to available MySQL built-in data
types. I have seen in many servers, the IP(Internet Protocol)
address is stored in CHAR(12), VARCHAR(15), TEXT and so
on.
The dotted-quad notation is just a way of writing for better
readability, it is not the original form of raw data. The IP
address is a UNSIGNED INTEGERS they are not strings.
So the question is how we can store the IP addresses with dot in
integer columns? The MySQL provides the built-it function to do
this operation. The functions are given below:
For IPv4 addresses:
INET_ATON()
mysql> select inet_aton('127.0.0.1');
+------------------------+
| inet_aton('127.0.0.1') |
+------------------------+
| 2130706433 | …
[Read more]