INET6_ATON() function in MySQL Last Updated : 23 Dec, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report This function in MySQL takes a dotted representation of an IPv4 or IPv6 address and returns a binary string that represents the numeric value of the address in network byte order. If the input address is not a valid IPv4 or IPv6 address this function returns NULL. Syntax : INET6_ATON(expr) Parameter : This method accepts only one parameter. expr - Input IPv4 or IPv6 address represented by a string. Returns : It returns the numeric value of the address in VARBINARY data type: VARBINARY(16) for IPv6 addresses and VARBINARY(4) for IPv4 addresses. Example-1 : Checking the equivalent VARBINARY representation for the following address '10.16.25.0' with the help of INET6_ATON Function. As it is a valid IPv4 address we will get result in VARBINARY form. SELECT INET6_ATON('10.16.25.0') AS EquivalentAddressValue ; Output : EQUIVALENTADDRESSVALUE0x0A101900 Example-2 : Checking the equivalent VARBINARY representation for the following address '2001:0db8:85a3:0000:0000:8a2e:0370:7334' with the help of INET6_ATON Function. As it is a valid IPv6 address we will get result in VARBINARY form. SELECT INET6_ATON('2001:0db8:85a3:0000:0000:8a2e:0370:7334') AS EquivalentAddressValue ; Output : EQUIVALENTADDRESSVALUE0x20010DB885A3000000008A2E03707334 Example-3 : Checking the equivalent VARBINARY representation for the following address '::0.5' with the help of INET6_ATON Function. As it is not a valid IPv4 or IPv6 address we will get NULL. SELECT INET6_ATON('::0.5') AS EquivalentAddressValue ; Output : EQUIVALENTADDRESSVALUE0x Comment More infoAdvertise with us Next Article INET6_ATON() function in MySQL J jana_sayantan Follow Improve Article Tags : SQL DBMS-SQL mysql Similar Reads INET_ATON() function in MySQL INET_ATON() : This function in MySQL takes the dotted-quad representation of an IPv4 address as a string and returns the numeric value of the given IP address in form of an integer. If the input address is not a valid IPv4 address this function returns NULL. The return address is calculated by the f 2 min read INSERT() function in MySQL INSERT() : This function in MySQL is used for inserting a string within a string, removing a number of characters from the original string. Syntax : INSERT(str, pos, len, newstr) Parameters : This method accepts four parameter. str - Original string in which we want to insert another string. pos - T 2 min read INET6_NTOA() function in MySQL INET6_NTOA() : This function in MySQL takes an IPv6 or IPv4 network address represented in numeric form as a binary string and it returns the string representation of the address as a string in the connection character set. It returns NULL if the address is not valid. Syntax : INET6_NTOA(expr) Param 2 min read INET_NTOA() function in MySQL INET_NTOA() : This function in MySQL takes the IPv4 address in network byte order and then it returns the address as a dotted-quad string representation. This function returns NULL if the input address is an invalid IPv4 address. Syntax : INET_NTOA(expr) Parameter : This function accepts only one pa 2 min read LEFT() Function in MySQL The LEFT() function in MySQL is used to extract a specified number of characters from the left side of a given string. It uses its second argument to decide, how many characters it should return. Syntax: LEFT (str, len)Parameter: This function accepts two parameters as mentioned above and described 1 min read Like