arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

INET6_ATON

Convert an IPv6 address to binary. This function takes an IPv6 (or IPv4) address string and returns it as a VARBINARY(16) string.

hashtag
Syntax

INET6_ATON(expr)

hashtag
Description

Given an IPv6 or IPv4 network address as a string, returns a binary string that represents the numeric value of the address.

No trailing zone ID's or traling network masks are permitted. For IPv4 addresses, or IPv6 addresses with IPv4 address parts, no classful addresses or trailing port numbers are permitted and octal numbers are not supported.

The returned binary string will be or for IPv6 and IPv4 addresses respectively.

Returns NULL if the argument is not understood.

MariaDB starting with

INET6_ATON can take as an argument.

INET6_ATON cannot take as an argument.

hashtag
Examples

hashtag
See Also

  • Data Type

This page is licensed: CC BY-SA / Gnu FDL

SELECT HEX(INET6_ATON('10.0.1.1'));
+-----------------------------+
| HEX(INET6_ATON('10.0.1.1')) |
+-----------------------------+
| 0A000101                    |
+-----------------------------+

SELECT HEX(INET6_ATON('48f3::d432:1431:ba23:846f'));
+----------------------------------------------+
| HEX(INET6_ATON('48f3::d432:1431:ba23:846f')) |
+----------------------------------------------+
| 48F3000000000000D4321431BA23846F             |
+----------------------------------------------+
VARBINARY(16)
VARBINARY(4)
INET6
INET6
INET6_NTOA()
INET_ATON()
INET6
spinner
10.5.0