The following procedure shows how to configure MySQL to permit
IPv6 connections by clients that connect to the local server
::1 local host address. The
instructions given here assume that your system supports IPv6.
Start the MySQL server with an appropriate
--bind-addressoption to permit it to accept IPv6 connections. For example, put the following lines in your server option file and restart the server:
[mysqld] bind-address = ::
Alternatively, you can bind the server to
::1, but that makes the server more restrictive for TCP/IP connections. It accepts only IPv6 connections for that single address and rejects IPv4 connections. For more information, see Section 22.214.171.124, “Configuring the MySQL Server to Permit IPv6 Connections”.
As an administrator, connect to the server and create an account for a local user who will connect from the
::1local IPv6 host address:
CREATE USER 'ipv6user'@'::1' IDENTIFIED BY 'ipv6pass';
For the permitted syntax of IPv6 addresses in account names, see Section 6.2.3, “Specifying Account Names”. In addition to the
CREATE USERstatement, you can issue
GRANTstatements that give specific privileges to the account, although that is not necessary for the remaining steps in this procedure.
Invoke the mysql client to connect to the server using the new account:
mysql -h ::1 -u ipv6user -pipv6pass
Try some simple statements that show connection information:
STATUS... Connection: ::1 via TCP/IP ... mysql>
SELECT CURRENT_USER();+----------------+ | CURRENT_USER() | +----------------+ | ipv6user@::1 | +----------------+