默认方式是:socket,比如/tmp/mysql.sock。因为是文件通信,所以不经过网卡,不受防火墙规则的影响。
的默认方式是:端口,比如127.0.0.1:9000
The error (2002) Can't connect to … normally means that there is no MySQL server running on the system or that you are using an incorrect Unix socket file name or TCP/IP port number when trying to connect to the server. You should also check that the TCP/IP port you are using has not been blocked by a firewall or port blocking service.
The error (2003) Can't connect to MySQL server on 'server' (10061) indicates that the network connection has been refused. You should check that there is a MySQL server running, that it has network connections enabled, and that the network port you specified is the one configured on the server.