????????????δ洢IP
????????????????2?????÷??????????IP????????棬???varchar????????????
??????????κ????????????????????????????????????????????????????????в?????????????????????????IP??????????????ú????????
??????????????????
??????MySQL??????????IP?????????????????????????????IP??????10λ???????????????????int????洢IP??varchar????洢IP?????????????????????????????varchar?????Σ???????????????洢?????????int????????????????varchar????
????IP????????inet_aton()
?????????????????????IP???
mysql> select inet_aton('255.255.255.255');
+------------------------------+
| inet_aton('255.255.255.255') |
+------------------------------+
|                   4294967295 |
+------------------------------+
1 row in set (0.00 sec)
mysql> select inet_aton('192.168.1.1');
+--------------------------+
| inet_aton('192.168.1.1') |
+--------------------------+
|               3232235777 |
+--------------------------+
1 row in set (0.00 sec)
mysql> select inet_aton('10.10.10.10');
+--------------------------+
| inet_aton('10.10.10.10') |
+--------------------------+
|                168430090 |
+--------------------------+
1 row in set (0.00 sec)
????????IP?????ο????????INT(10)??????IP???????????????0??????????IP?????
?????????IP????inet_ntoa()
mysql> select inet_ntoa(4294967295);
+-----------------------+
| inet_ntoa(4294967295) |
+-----------------------+
| 255.255.255.255       |
+-----------------------+
1 row in set (0.00 sec)
mysql> select inet_ntoa(3232235777);
+-----------------------+
| inet_ntoa(3232235777) |
+-----------------------+
| 192.168.1.1           |
+-----------------------+
1 row in set (0.00 sec)
mysql> select inet_ntoa(168430090);
+----------------------+
| inet_ntoa(168430090) |
+----------------------+
| 10.10.10.10          |
+----------------------+
1 row in set (0.00 sec)
mysql> select inet_ntoa(0);
+--------------+
| inet_ntoa(0) |
+--------------+
| 0.0.0.0      |
+--------------+
1 row in set (0.00 sec)
???????0???? 0.0.0.0