Command-Line Format | --bind-address=name | ||
Config-File Format | bind-address | ||
Permitted Values | |||
Type | string | ||
Default | 0.0.0.0 | ||
Range | 0.0.0.0-255.255.255.255 |
The IP address to bind to. Only one address can be selected. If this option is specified multiple times, the last address given is used.
If no address or 0.0.0.0
is specified, the server listens on all interfaces.
mysql启动的时候,也就是本地localhost的时候,他自己会找127.0.0.1
可以看一下netstat -ant,端口listen的时候,是0.0.0.0也就是说ALL,
You can bind only to network interfaces available on the machine where MySQL is running.
Assume your PC has 3 network interfaces:
- 127.0.0.1 (local host or local loop)
- 192.168.0.50 (network card/cable)
- 192.168.0.70 (network card/wireless)
Normally, the MySQL server will listen on all three interfaces. This is the default, but if it makes you happy :-) you could set it explicitly, with --bind-address='0.0.0.0'.
If you want MySQL to listen only on the cable interface you would set --bind-address='192.168.0.50'.