Support for IPv6 in MySQL includes these capabilities:MySQL对IPv6的支持包括以下功能:
MySQL Server can accept TCP/IP connections from clients connecting over IPv6. For example, this command connects over IPv6 to the MySQL server on the local host:MySQL服务器可以接受来自通过IPv6连接的客户端的TCP/IP连接。例如,此命令通过IPv6连接到本地主机上的MySQL服务器:
shell> mysql -h ::1
To use this capability, two things must be true:要使用此功能,必须满足以下两点:
Your system must be configured to support IPv6. See Section 5.1.13.1, “Verifying System Support for IPv6”.您的系统必须配置为支持IPv6。请参阅第5.1.13.1节,“验证IPv6的系统支持”。
The default MySQL server configuration permits IPv6 connections in addition to IPv4 connections. To change the default configuration, start the server with the 默认的MySQL服务器配置除了允许IPv4连接外,还允许IPv6连接。要更改默认配置,请将bind_address
system variable set to an appropriate value. bind_address
系统变量设置为适当的值来启动服务器。See Section 5.1.8, “Server System Variables”.请参阅第5.1.8节,“服务器系统变量”。
MySQL account names permit IPv6 addresses to enable DBAs to specify privileges for clients that connect to the server over IPv6. MySQL帐户名允许IPv6地址,使DBA能够为通过IPv6连接到服务器的客户端指定权限。See Section 6.2.4, “Specifying Account Names”. 请参阅第6.2.4节,“指定帐户名”。IPv6 addresses can be specified in account names in statements such as IPv6地址可以在CREATE USER
, GRANT
, and REVOKE
. For example:CREATE USER
、GRANT
和REVOKE
等语句中的帐户名中指定。例如:
mysql>CREATE USER 'bill'@'::1' IDENTIFIED BY 'secret';
mysql>GRANT SELECT ON mydb.* TO 'bill'@'::1';
IPv6 functions enable conversion between string and internal format IPv6 address formats, and checking whether values represent valid IPv6 addresses. For example, IPv6函数允许在字符串和内部格式IPv6地址格式之间进行转换,并检查值是否表示有效的IPv6地址。例如,INET6_ATON()
and INET6_NTOA()
are similar to INET_ATON()
and INET_NTOA()
, but handle IPv6 addresses in addition to IPv4 addresses. INET6_ATON()
和INET6_NTOA()
类似于INET_ATON()
和LINET_NTOA()
,但除了处理IPv4地址外,还处理IPv6地址。See Section 12.24, “Miscellaneous Functions”.请参阅第12.24节,“其他功能”。
From MySQL 8.0.14, Group Replication group members can use IPv6 addresses for communications within the group. A group can contain a mix of members using IPv6 and members using IPv4. 从MySQL 8.0.14开始,组复制组成员可以在组内使用IPv6地址进行通信。一个组可以包含使用IPv6的成员和使用IPv4的成员。See Section 18.5.5, “Support For IPv6 And For Mixed IPv6 And IPv4 Groups”.请参阅第18.5.5节,“支持IPv6和混合IPv6和IPv4组”。
The following sections describe how to set up MySQL so that clients can connect to the server over IPv6.以下部分描述了如何设置MySQL,以便客户端可以通过IPv6连接到服务器。