Bug #48600 Clients do not connect with an IPv6 as host.
Submitted: 6 Nov 2009 17:14 Modified: 17 Nov 2009 12:00
Reporter: Horst Hunger Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:6.0-codebase OS:Linux (SUSE 11.1, 2.6.27.37-0.1-default #1 SMP 2009-10-15 14:56:58 +0200 x86_64 x86_64 x86_64 GNU/Linux)
Assigned to: CPU Architecture:Any

[6 Nov 2009 17:14] Horst Hunger
Description:
The client programs mysql, mysqladmin, mysqldump, mysqlcheck and mysqlshow do not accept IPv6 as host (though IPv4 is). That shall also checked for mysqlimport, mysqlslap, mysqlaccess, mysqlbinlog, mysqldumpslow, mysqlhotcopy, mysql_convert_table_format, mysqlsetpermission, my_print_defaults and resolveip.

let $IPv6= 0:0:0:0:0:0:0:1;
--exec $MYSQLADMIN --no-defaults --default-character-set=latin1 -h $IPv6 -S $MASTER_MYSOCK -P $MASTER_MYPORT  -u root ping
--exec $MYSQL_CHECK -h $IPv6 -S $MASTER_MYSOCK -P $MASTER_MYPORT  -u root test
--exec $MYSQL_DUMP -h $IPv6 -S $MASTER_MYSOCK -P $MASTER_MYPORT  -u root test
--exec $MYSQL_SHOW -h $IPv6 -S $MASTER_MYSOCK -P $MASTER_MYPORT  -u root
--exec $MYSQL --host=$IPv6 --port=$MASTER_MYPORT --user=root test -e "SELECT current_user();SELECTuser();"

These statements failed with messages like

/home/horst/bzr/mysql-6.0-ipv6/client/.libs/mysqladmin: connect to server at '0:0:0:0:0:0:0:1' failed                                                                                                 
error: 'Can't connect to MySQL server on '0:0:0:0:0:0:0:1' (111)'                                  
Check that mysqld is running on 0:0:0:0:0:0:0:1 and that the port is 13000.                        
You can check this by doing 'telnet 0:0:0:0:0:0:0:1 13000'                                         
mysqltest: At line 47: command "$MYSQLADMIN --no-defaults --default-character-set=latin1 -h $IPv6 -S $MASTER_MYSOCK -P $MASTER_MYPORT  -u root ping " failed                                  

Try also IPv4 127.0.0.1. That will succeed.        
Also, the IP "0:0:0:0:0:FFFF:127.0.0.1" succeeds, but that's not enough.

How to repeat:
set "--skip-name-resolve" when starting mysqld.
execute the statements above with mtr or execute the attached test after having
removed the comment char. That will be attached soon.
[6 Nov 2009 17:21] Valeriy Kravchuk
Sorry, but I can NOT repeat this with recent 6.0-codebase from bzr on Mac OS X:

77-52-7-73:mysql-5.1 openxs$ telnet 0:0:0:0:0:0:0:1 3306
Trying ::1...
Connected to localhost.
Escape character is '^]'.
@
6.0.14-alpha-debugc7)fFjd0"Y{}$9/!WqV^CConnection closed by foreign host.
77-52-7-73:mysql-5.1 openxs$ cd ../../dbs/6.0-codebase/
77-52-7-73:6.0-codebase openxs$ bin/mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 6.0.14-alpha-debug Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> exit
Bye
77-52-7-73:6.0-codebase openxs$ bin/mysql -uroot -P3306 --host=0:0:0:0:0:0:0:1 test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 6.0.14-alpha-debug Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> exit
Bye
77-52-7-73:6.0-codebase openxs$ bin/mysqladmin -uroot -P3306 --host=0:0:0:0:0:0:0:1 status
Uptime: 84188  Threads: 1  Questions: 50  Slow queries: 0  Opens: 24  Flush tables: 1  Open tables: 16  Queries per second avg: 0.0

What am I doing wrong? What OS did you test on?
[6 Nov 2009 17:39] Horst Hunger
My OS is OpenSUSE 11.1 (see OS entry above). My 6.0-codebase is for Okt 27.
Could be, that I shall update it and repeat the tests.
[6 Nov 2009 17:46] Valeriy Kravchuk
My 6.0-codebase has latest timestamp: Tue 2009-11-03 11:37:33 +0300 in the log. So, please, try with a recent bzr pull and inform about the results.
[6 Nov 2009 18:47] Davi Arnaut
111 is the code for connection refused. Please ensure that the server is listening on that address.
[17 Nov 2009 12:00] Horst Hunger
Thanks Davi, that was the right hint. I set it to "No bug" as I have simply forgotten to let mysqld listen to "::1" with the help of "--bind-address". 
Setting that option let all work as expected. Sorry.