Spec-Zone .ru
спецификации, руководства, описания, API

5.1.9.3. Connecting Using the IPv6 Local Host Address

The following procedure shows how to configure MySQL to permit IPv6 connections by clients that connect to the local server using the ::1 local host address. The instructions given here assume that your system supports IPv6.

  1. Start the MySQL server with an appropriate --bind-address option 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 5.1.9.2, "Configuring the MySQL Server to Permit IPv6 Connections".

  2. As an administrator, connect to the server and create an account for a local user who will connect from the ::1 local IPv6 host address:

    mysql> 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 USER statement, you can issue GRANT statements that give specific privileges to the account, although that is not necessary for the remaining steps in this procedure.

  3. Invoke the mysql client to connect to the server using the new account:

    shell> mysql -h ::1 -u ipv6user
                        -pipv6pass
  4. Try some simple statements that show connection information:

    mysql> STATUS...Connection:   ::1 via TCP/IP...mysql> SELECT CURRENT_USER(), @@bind_address;+----------------+----------------+| CURRENT_USER() | @@bind_address |+----------------+----------------+| ipv6user@::1   | ::             |+----------------+----------------+