Home > Database > Mysql Tutorial > body text

MySql Ip地址 储存

WBOY
Release: 2016-06-07 16:27:11
Original
927 people have browsed it

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       |
+-----------------------+
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template