MySQL IS_IPV6() Function

In MySQL, the IS_IPV6() function checks whether the given parameter is a valid IPv6 address.

IS_IPV6() Syntax

Here is the syntax of the MySQL IS_IPV6() function:



Required. An IPv6 address to check.

Return value

The MySQL IS_IPV6() function checks if the given parameter is a valid IPv6 address and returns 1 if it is, otherwise returns 0.

For a given parameter, if IS_IPV6() returns 1, INET6_ATON() will return a non-NULL value.

If the argument is NULL, the function will return NULL.

IS_IPV6() Examples

This example demonstrates IS_IPV6() the basic usage of .

SELECT IS_IPV6(''), IS_IPV6('fdfe::5a55:caff:fefa:9089');
| IS_IPV6('') | IS_IPV6('fdfe::5a55:caff:fefa:9089') |
|                        0 |                                    1 |

Here, since is an IPv4 address, not an IPv6 address, IS_IPV6('') returned 0.