MySQL存储IP地址的方法

 IP转数字函数inet_aton()

mysql> selectinet_aton('192.168.1.1'); 

+--------------------------+

| inet_aton('192.168.1.1') |

+--------------------------+

|        3232235777 |

+--------------------------+

1 row inset(0.00 sec)

数字转IP函数inet_ntoa()

mysql> selectinet_ntoa(3232235777);

+-----------------------+

| inet_ntoa(3232235777) |

+-----------------------+

| 192.168.1.1      |

+-----------------------+

1 row inset(0.00 sec)

猜你喜欢

转载自blog.csdn.net/weixin_36691991/article/details/88623461
今日推荐