如果你在windows 或Linux系统已经安装了mysql/mariadb,并且操作系统本身已经支持了ipv6。
在/etc/my.conf 这样配置可以让mysql也支持ipv6
在[mysqld]选项下增加bind-address = ::配置
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
port=3306
bind-address = ::
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
其中,bind-address = :: 就会让你的数据库监听ipv6的请求。
[root@localhost etc]# netstat -an|grep ::
tcp6 0 0 :::13306 :::* LISTEN
重启mysql使配置生效:
/etc/init.d/mysqld restart