我正在尝试将二进制 IP 转换为人类可读的 IP
SELECT HEX( `ip_bin` ) FROM `log_metadata`
给我
4333D26E000000000000000000000000
和
SELECT INET_NTOA(0x4333D26E)
给我67.51.210.110
所以我尝试了:
SELECT
SUBSTRING( CONVERT(HEX(`ip_bin`), CHAR(32)), 1, 8 ) AS `A`
, INET_NTOA(
SUBSTRING( CONVERT(HEX(`ip_bin`), CHAR(32)), 1, 8 )
) AS `B`
, INET_NTOA(hex(`ip_bin`)) AS `C`
, INET_NTOA(`ip_bin`) AS `D`
FROM `log_metadata`
但我只得到
+----------+------------+------------+---------+
| A | B | C | D |
+----------+------------+------------+---------+
| 4333D26E | 0.0.16.237 | 0.0.16.237 | 0.0.0.0 |
+----------+------------+------------+---------+
有什么建议么?