If the socket file reporting in phpinfo() does not exist, does it create a TCP connection to the MySQL server?
I am asking because A is a web server and B is a MySQL ser开发者_StackOverflowver. A does not have the /var/lib/mysql directory as defined in phpinfo() but it is still able to connect to server B.
If they're distinct servers, then it'd be a TCP connection. file sockets do not function over the network - they're local usage only.
The socket is the default for connecting to a local MySQL server. Otherwise, a TCP connection is used.
If you want to use a TCP connection for a local server, use the following:
mysql -h 127.0.0.1 -P 3306
精彩评论