wildcard address

From the docs: The wildcard is a special local IP address. It usually means "any" and can only be used for bind operations.

The value of this IP address is 0.0.0.0. If you have two network adapters, one with IP address 1.1.1.1 and one with IP address 2.2.2.2, then you can create a listening socket and bind it to 1.1.1.1 so that the socket will not bind to 2.2.2.2. You can also create a listening socket and bind it to 2.2.2.2, so that it will not bind to 1.1.1.1. If you do not care and want your socket to bind to all network cards, then you bind it to the wildcard address.

Another special value would be 127.0.0.1, meaning that only clients on the same computer could connect to your server.


A wildcard mask is a mask of bits that indicates which parts of an IP address can assume any value. In the Cisco IOS, they are used in several places, for example:

  • To indicate the size of a network or subnet for some routing protocols, such as OSPF.
  • To indicate what IP addresses should be permitted or denied in access control lists (ACLs).

翻译: Command-Line Format --bind-address=addr System Variable bind_address Scope Global Dynamic No SET_VAR Hint Applies No Type String Default Value * The MySQL server listens on one or more network sockets for TCP/IP connections. Each socket is bound to one address, but it is possible for an address to map onto multiple network interfaces. To specify how the server should listen for TCP/IP connections, set the bind_address system variable at server startup. The server also has an admin_address system variable that enables administrative connections on a dedicated interface. See Section 7.1.12.1, “Connection Interfaces”. If bind_address is specified, it accepts a list of one or more address values, each of which may specify a single non-wildcard IP address or host name. Each address may include a network namespace specifier. If only one address is specified, it may make use of one of the wildcard address formats that permit listening on multiple network interfaces (*, 0.0.0.0, or ::). Multiple addresses are separated by commas. When multiple values are listed, each value must specify a single non-wildcard IP address (either IPv4 or IPv6) or a host name, and wildcard address formats (*, 0.0.0.0, or ::) are not allowed. IP addresses can be specified as IPv4 or IPv6 addresses. For any value that is a host name, the server resolves the name to an IP address and binds to that address. If a host name resolves to multiple IP addresses, the server uses the first IPv4 address if there are any, or the first IPv6 address otherwise. The server treats different types of addresses as follows: If the address is *, the server accepts TCP/IP connections on all server host IPv4 interfaces, and, if the server host supports IPv6, on all IPv6 interfaces. Use this address to permit both IPv4 and IPv6 connections on all server interfaces. This value is the default. If the variable specifies a list of multiple values, this value is not permitted. If the address is 0.0.0.0, the server accepts TCP/IP connections on all server host IPv4 interfaces. If the variable specifies a list of multiple values, this value is not permitted. If the address is ::, the server accepts TCP/IP connections on all server host IPv4 and IPv6 interfaces. If the variable specifies a list of multiple values, this value is not permitted. 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. These rules apply to specifying a network namespace for an address: A network namespace can be specified for an IP address or a host name. A network namespace cannot be specified for a wildcard IP address. For a given address, the network namespace is optional. If given, it must be specified as a /ns suffix immediately following the address. An address with no /ns suffix uses the host system global namespace. The global namespace is therefore the default. An address with a /ns suffix uses the namespace named ns. The host system must support network namespaces and each named namespace must previously have been set up. Naming a nonexistent namespace produces an error. If the variable value specifies multiple addresses, it can include addresses in the global namespace, in named namespaces, or a mix. For additional information about network namespaces, see Section 7.1.14, “Network Namespace Support”. If binding to any address fails, the server produces an error and does not start. Examples: bind_address=* The server listens on all IPv4 or IPv6 addresses, as specified by the * wildcard. bind_address=198.51.100.20 The server listens only on the 198.51.100.20 IPv4 address. bind_address=198.51.100.20,2001:db8:0:f101::1 The server listens on the 198.51.100.20 IPv4 address and the 2001:db8:0:f101::1 IPv6 address. bind_address=198.51.100.20,* This produces an error because wildcard addresses are not permitted when bind_address names a list of multiple values. bind_address=198.51.100.20/red,2001:db8:0:f101::1/blue,192.0.2.50 The server listens on the 198.51.100.20 IPv4 address in the red namespace, the 2001:db8:0:f101::1 IPv6 address in the blue namespace, and the 192.0.2.50 IPv4 address in the global namespace. When bind_address names a single value (wildcard or non-wildcard), the server listens on a single socket, which for a wildcard address may be bound to multiple network interfaces. When bind_address names a list of multiple values, the server listens on one socket per value, with each socket bound to a single network interface. The number of sockets is linear with the number of values specified. Depending on operating system connection-acceptance efficiency, long value lists might incur a performance penalty for accepting TCP/IP connections. Because file descriptors are allocated for listening sockets and network namespace files, it may be necessary to increase the open_files_limit system variable. If you intend to bind the server to a specific address, be sure that the mysql.user system table contains an account with administrative privileges that you can use to connect to that address. Otherwise, you cannot 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.
07-03
翻译: bind_address Command-Line Format --bind-address=addr System Variable bind_address Scope Global Dynamic No SET_VAR Hint Applies No Type String Default Value * The MySQL server listens on one or more network sockets for TCP/IP connections. Each socket is bound to one address, but it is possible for an address to map onto multiple network interfaces. To specify how the server should listen for TCP/IP connections, set the bind_address system variable at server startup. The server also has an admin_address system variable that enables administrative connections on a dedicated interface. See Section 7.1.12.1, “Connection Interfaces”. If bind_address is specified, its value must satisfy these requirements: Prior to MySQL 8.0.13, bind_address accepts a single address value, which may specify a single non-wildcard IP address or host name, or one of the wildcard address formats that permit listening on multiple network interfaces (*, 0.0.0.0, or ::). As of MySQL 8.0.13, bind_address accepts either a single value as just described, or a list of comma-separated values. When the variable names a list of multiple values, each value must specify a single non-wildcard IP address (either IPv4 or IPv6) or a host name. Wildcard address formats (*, 0.0.0.0, or ::) are not allowed in a list of values. As of MySQL 8.0.22, addresses may include a network namespace specifier. IP addresses can be specified as IPv4 or IPv6 addresses. For any value that is a host name, the server resolves the name to an IP address and binds to that address. If a host name resolves to multiple IP addresses, the server uses the first IPv4 address if there are any, or the first IPv6 address otherwise. The server treats different types of addresses as follows: If the address is *, the server accepts TCP/IP connections on all server host IPv4 interfaces, and, if the server host supports IPv6, on all IPv6 interfaces. Use this address to permit both IPv4 and IPv6 connections on all server interfaces. This value is the default. If the variable specifies a list of multiple values, this value is not permitted. If the address is 0.0.0.0, the server accepts TCP/IP connections on all server host IPv4 interfaces. If the variable specifies a list of multiple values, this value is not permitted. If the address is ::, the server accepts TCP/IP connections on all server host IPv4 and IPv6 interfaces. If the variable specifies a list of multiple values, this value is not permitted. 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. These rules apply to specifying a network namespace for an address: A network namespace can be specified for an IP address or a host name. A network namespace cannot be specified for a wildcard IP address. For a given address, the network namespace is optional. If given, it must be specified as a /ns suffix immediately following the address. An address with no /ns suffix uses the host system global namespace. The global namespace is therefore the default. An address with a /ns suffix uses the namespace named ns. The host system must support network namespaces and each named namespace must previously have been set up. Naming a nonexistent namespace produces an error. If the variable value specifies multiple addresses, it can include addresses in the global namespace, in named namespaces, or a mix. For additional information about network namespaces, see Section 7.1.14, “Network Namespace Support”. If binding to any address fails, the server produces an error and does not start. Examples: bind_address=* The server listens on all IPv4 or IPv6 addresses, as specified by the * wildcard. bind_address=198.51.100.20 The server listens only on the 198.51.100.20 IPv4 address. bind_address=198.51.100.20,2001:db8:0:f101::1 The server listens on the 198.51.100.20 IPv4 address and the 2001:db8:0:f101::1 IPv6 address. bind_address=198.51.100.20,* This produces an error because wildcard addresses are not permitted when bind_address names a list of multiple values. bind_address=198.51.100.20/red,2001:db8:0:f101::1/blue,192.0.2.50 The server listens on the 198.51.100.20 IPv4 address in the red namespace, the 2001:db8:0:f101::1 IPv6 address in the blue namespace, and the 192.0.2.50 IPv4 address in the global namespace. When bind_address names a single value (wildcard or non-wildcard), the server listens on a single socket, which for a wildcard address may be bound to multiple network interfaces. When bind_address names a list of multiple values, the server listens on one socket per value, with each socket bound to a single network interface. The number of sockets is linear with the number of values specified. Depending on operating system connection-acceptance efficiency, long value lists might incur a performance penalty for accepting TCP/IP connections. Because file descriptors are allocated for listening sockets and network namespace files, it may be necessary to increase the open_files_limit system variable. If you intend to bind the server to a specific address, be sure that the mysql.user system table contains an account with administrative privileges that you can use to connect to that address. Otherwise, you cannot 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.
最新发布
07-03
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值