mysql ip地址 存储 特殊字段-ipv4地址的存取 存取ip地址可以使用mysql中的两个函数将ipv4字符串转换成为整数,整数的存取比字符串快。两个特殊的函数是: ip地址转成数字:select inet_aton("192.168.1.1"); 结果 +--------------------------+ | inet_aton("
mysql ip地址 存储特殊字段-ipv4地址的存取
存取ip地址可以使用mysql中的两个函数将ipv4字符串转换成为整数,整数的存取比字符串快。两个特殊的函数是:
ip地址转成数字:select inet_aton("192.168.1.1");
结果
+--------------------------+
| inet_aton("192.168.1.1") |
+--------------------------+
| 3232235777 |
+--------------------------+
数字转换成为ip地址
select inet_ntoa(3232235778);
结果为:
+-----------------------+
| inet_ntoa(3232235778) |
+-----------------------+
| 192.168.1.2 |
+-----------------------+.syntaxhighlighter{padding-top:20px;padding-bottom:20px;}
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!