开发者

PHP MySQL connection without socket file

开发者 https://www.devze.com 2023-03-14 00:25 出处:网络
If the socket file reporting in phpinfo() does not exist, does it create a TCP connection to the MySQL server?

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号