Топ-100
 

INET6_ATON

RDBMS Type: MySQL
Topic

Syntax:
INET6_ATON(expr)

Given an IPv6 or IPv4 network address as a string, returns a binary
string that represents the numeric value of the address in network byte
order (big endian). Because numeric-format IPv6 addresses require more
bytes than the largest integer type, the representation returned by
this function has the VARBINARY data type: VARBINARY(16) for IPv6
addresses and VARBINARY(4) for IPv4 addresses. If the argument is not a
valid address, INET6_ATON() returns NULL.

URL: https://dev.mysql.com/doc/refman/8.0/en/miscellaneous-functions.html

Example

mysql> SELECT HEX(INET6_ATON('fdfe::5a55:caff:fefa:9089'));
-> 'FDFE0000000000005A55CAFFFEFA9089'
mysql> SELECT HEX(INET6_ATON('10.0.5.9'));
-> '0A000509'