The MySQL server listens on a single network socket for TCP/IP
connections. This socket is bound to a single address, but it is
possible for an address to map onto multiple network interfaces.
The default address is 0.0.0.0
. To specify an
address explicitly, use the
--bind-address=
option at server startup, where addr
addr
is an IPv4 or IPv6 address or a host name. (IPv6 addresses are
not supported before MySQL 5.5.3.) If
addr
is a host name, the server
resolves the name to an IP address and binds to that address.
The server treats different types of addresses as follows:
If the address is
0.0.0.0
, the server accepts TCP/IP connections on all server host IPv4 interfaces.If the address is
::
, the server accepts TCP/IP connections on all server host IPv4 and IPv6 interfaces. Use this address to permit both IPv4 and IPv6 connections on all server interfaces.If the address is an IPv4-mapped address, the server accepts TCP/IP connections for that address, in either IPv4 or IPv6 format. For example, if the server is bound to
::ffff:127.0.0.1
, clients can connect using--host=127.0.0.1
or--host=::ffff:127.0.0.1
.If the address is a “regular” IPv4 or IPv6 address (such as
127.0.0.1
or::1
), the server accepts TCP/IP connections only for that IPv4 or IPv6 address.
If you intend to bind the server to a specific address, be sure
that the mysql.user
grant table contains an
account with administrative privileges that you can use to
connect to that address. Otherwise, you will not be able to shut
down the server. For example, if you bind the server to
::
, you can connect to it using all existing
accounts. But if you bind the server to ::1
,
it accepts connections only on that address. In that case, first
make sure that the 'root'@'::1'
account is
present in the mysql.user
table so you can
still connect to the server to shut it down.