MySQL IPv4 IPv6

Source: Internet
Author: User
Tags numeric value

How can I use a MySQL method rather than a script to judge?INET6_ATON(expr)

Https://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html#function_inet-aton

Https://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html#function_inet6-aton

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

The following examples use to HEX() display the INET6_ATON() result in printable form:

MySQL IPv4 IPv6

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.