mariadb
MariaDB10

ipv6 で MariaDB サーバに接続

mysql(MariaDB monitor)でipv6アドレスを用いてMariaDBに接続する。

# mysql -h fe80::20c:29ff:fedc:d61f%eth0 -u ipv6user --password=password
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 14
Server version: 10.2.11-MariaDB MariaDB Server

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

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

MariaDB [(none)]> select user,host,password from mysql.user;
+----------+-----------+-------------------------------------------+
| user     | host      | password                                  |
+----------+-----------+-------------------------------------------+
| root     | localhost |                                           |
| root     | 127.0.0.1 |                                           |
| root     | ::1       |                                           |
| ipv6user | %         | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
+----------+-----------+-------------------------------------------+
7 rows in set (0.00 sec)

MariaDB [(none)]>

リンクローカルアドレスにゾーンインデックス %eth0 を付与しないと接続できなかった。

# mysql -h fe80::20c:29ff:fedc:d61f -u ipv6user --password=password
ERROR 2003 (HY000): Can't connect to MySQL server on 'fe80::20c:29ff:fedc:d61f' (22 "Invalid argument")

参考までに ping(ping6) の実行結果。

# ping6 fe80::20c:29ff:fedc:d61f%eth0 -c 4
PING fe80::20c:29ff:fedc:d61f%eth0(fe80::20c:29ff:fedc:d61f%eth0) 56 data bytes
64 bytes from fe80::20c:29ff:fedc:d61f%eth0: icmp_seq=1 ttl=64 time=0.509 ms
64 bytes from fe80::20c:29ff:fedc:d61f%eth0: icmp_seq=2 ttl=64 time=0.512 ms
64 bytes from fe80::20c:29ff:fedc:d61f%eth0: icmp_seq=3 ttl=64 time=0.494 ms
64 bytes from fe80::20c:29ff:fedc:d61f%eth0: icmp_seq=4 ttl=64 time=0.457 ms

--- fe80::20c:29ff:fedc:d61f%eth0 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 0.457/0.493/0.512/0.021 ms