Bug #8836 IPv6 support
Submitted: 27 Feb 2005 22:38 Modified: 28 Oct 2010 18:24
Reporter: [ name withheld ] Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S4 (Feature request)
Version:ALL OS:Any (ALL)
Assigned to: CPU Architecture:Any
Tags: Contribution, ipv6
Triage: Triaged: D5 (Feature request)

[27 Feb 2005 22:38] [ name withheld ]
Description:
Please add IPv6 support for MySQL server, clients and connectors.

There is a patch available at 
http://www.ngn.euro6ix.org/IPv6/mysql/
that adds IPv6 support to MySQL

How to repeat:
IPv6 addresses are not recognized.
[13 May 2007 19:55] Maarten Vanraes
what is the current status? It seems this is still not working...
[21 Jan 2008 16:10] Pete French
Just a 'me too' really - I tried the latest version of mysql on FreeBSD and there is still no IPv6 support as far as I can tell. Do we have any kind of timetabl;e for when this will be available ? It's not a large change after all...
[3 Oct 2008 18:30] Konstantin Osipov
This has been done at least in part in 6.0.
See http://forge.mysql.com/worklog/task.php?id=798
[24 Mar 2010 10:00] Etienne Duble
Something which might help: I am developping a Linux tool called IPv6 CARE: IPv6 Compliant Automatic Runtime Environment. It detects networking API calls and patch processes on the fly in order to make them IPv6 compliant.
As shown on the video at https://twiki.cern.ch/twiki/bin/view/EGEE/IPv6CARE, it can be used to make mysql IPv6 compliant.
Package and user guide are at http://sourceforge.net/projects/ipv6-care/
[23 Sep 2010 1:30] Trent Lloyd
For some reason this bug is closed silently, yet it's support is actually available in 5.5 betas.. this is not at all clear from the report.

Can we document this better somehow in general? Not only in the bug but in documentation.  Searching the docs for IPv6 is relatively fruitless at the moment.
[23 Sep 2010 8:39] Daniƫl van Eeden
IPv6 Support consists of a few parts:
* Server support 
** Listen on a IPv6 Socket
** DNS resolving on IPv6
** Replication on IPv6
** IPv6 only operation (e.g. not dual stack)

* NDB Cluster support
** Connect to data nodes over IPv6
** Connect to mgmt nodes over IPv6

* Client support
** mysql connect over IPv6
** mysqlbinlog connect over IPv6
** mysqldump connect over IPv6
** MySQL Workbench connect over IPv6

* Connector support
** Connector/J and Connector/Net (inc. interceptor for the Query Analyzer)
** Other connectors w/o interceptors

* MySQL Enterprise support for IPv6
** Monitor server over IPv6
** Advisors for IPv6 usage

* MySQL SQL support for IPv6
** INET_ATON and INET_NTOA capable for IPv6

* Engine Support for IPv6
** Federated and/or Federated/X with IPv6 support
** DB2 Storage engine with IPv6 support?

What will be supported in the 5.5 release? and on which platforms?
[28 Oct 2010 18:24] Paul Dubois
Noted in 5.5.3 changelog.

MySQL now supports IPv6 connections to the local host, using the
address ::1. For example:

shell> mysql -h ::1 

The address ::1 can be specified in account names in statements such
as CREATE USER, GRANT, and REVOKE. For example:

mysql> CREATE USER 'bill'@'::1' IDENTIFIED BY 'secret';
mysql> GRANT SELECT ON mydb.* TO 'bill'@'::1'; 

The default set of accounts created during MySQL installation now
includes an account for 'root'@'::1'.

See http://dev.mysql.com/doc/refman/5.5/en/account-names.html,
and http://dev.mysql.com/doc/refman/5.5/en/default-privileges.html.
[12 Jan 2011 11:19] TheAshwaniK Kumar
NOTE: THIS IS NOT A FIX, MYSQL CAN HANDLE THIS IN NEXT RELEASE OF CONNECTOR IF THEY WANT. 
CHECK LICENSING BEFORE MODIFYING THE SRC CODE.  I WOULD NOT BE RESPONSIBLE FOR ANY BREACH.

I think the Mysql JDBC connector does not support the IPv6 Type of addresses.

tried some reverse engineering and experimenting with the mysql JDBC connector source code, I found that it could support IPv6 after all.

mysql-connector-java-5.1.14-bin.jar,class at com.mysql.jdbc/NonRegisteringDriver.java

If you see the code inside function parseHostPortPair(),code is responsible for parsing the host port.since our IPv6 contains multiple colon ":",it fails

protected static String[] parseHostPortPair(String hostPortPair) throws SQLException {
...
if (portIndex != -1)
{
if (portIndex + 1 < hostPortPair.length())
{
String portAsString = hostPortPair.substring(portIndex + 1);
hostname = hostPortPair.substring(0, portIndex);
splitValues[0] = "hostname";
splitValues[1] = portAsString;
}
else
{ throw SQLError.createSQLException(); } } ...

Experiment
==========

Hard code your IPv6 address here splitValues[0] = "fe80::5ed6:baff:fe14:a23e"; and splitValues[1] = null;

Actual Fix: To be figured out. How to parse the IPv6 address containing colons ":"

And see It works :)
[12 Jan 2011 11:32] Tonci Grgin
Thank you Ashwani, I'll take it into consideration.
[12 Jan 2011 14:17] Mark Matthews
Ashwani,

I'd prefer that for IPv6 numeric addresses, you use the more flexible URL format available starting with 5.1.14:

jdbc:mysql://address=(protocol=tcp)(host=fe80::5ed6:baff:fe14:a23e)(port=3306)/db

Parsing colon-delimited addresses, and ports is too fragile.
[12 Jan 2011 16:27] TheAshwaniK Kumar
Thanks Mark,
That Works, But I am surprised that no where over the internet I could find the URL construction mentioned by you.

jdbc:mysql://address=(protocol=tcp)(host=fe80::5ed6:baff:fe14:a23e)(port=3306)/db

Also, the documentation at http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html is not updated. Do you know any place where I can find the documentation explaining the URL construction that you told us.

Thanks anyways mate, where were you all these days.. I wish we could have found you earlier.

regards.
[12 Jan 2011 16:36] Mark Matthews
Always check the CHANGES file that comes with the JDBC driver. I've filed a bug report for the docs to include this information (Bug#59451)
[12 Jan 2011 16:40] TheAshwaniK Kumar
Great.

Thanks,
[10 Jul 2011 15:15] Owen DeLong
It should not be fragile to parse a properly constructed IPv6 address with port number.

The required format for an IPv6 address with a port number is:

[IPv6Addr]:port

Where the [] are literally [ and ], IPv6Addr is the IPv6 address in standard colon notation, and
the port number is the port number in decimal. For example, to specify port 9021 on server 2001:db8:3915::dead:beef, it should be written [2001:db8:3915::dead:beef]:9021

Also, I don't see it mentioned in here, but, in addition to the other support required for IPv6
to be fully and properly supported by MySQL, IPv6 addresses have to be valid in grant tables.
[29 Feb 2012 11:30] Trent Lloyd
MySQL 5.5 and later supports IPv6 fully for client connections, but is 
currently undocumented. 

To configure MySQL 5.5 and later to accept IPv6 connections, use the 
following configuration option. 

bind-address = :: 

MySQL 5.1 and earlier cannot accept IPv6 connections in any configuration.
[17 Apr 2012 15:39] Paul Dubois
This might help:

http://dev.mysql.com/doc/refman/5.5/en/ipv6-support.html
[22 Sep 2014 14:13] Mark Callaghan
This is a very broad feature request. I can't figure out what has yet to be fixed. Does the JDBC driver work for IPv6?