开发者

Specifying protocol in mysql connect (PHP)

How do you specify pro开发者_开发问答tocol = TCP in myql_connect()?


By reading the manual:

Whenever you specify "localhost" or "localhost:port" as server, the MySQL client library will override this and try to connect to a local socket (named pipe on Windows). If you want to use TCP/IP, use "127.0.0.1" instead of "localhost".

http://www.php.net/manual/en/function.mysql-connect.php


To my understanding mysql_connect() uses TCP/IP or socket. Dependable on what address you give it.

This is from PHP Manual

Note: Whenever you specify "localhost" or "localhost:port" as server, the MySQL client library will override this and try to connect to a local socket (named pipe on Windows). If you want to use TCP/IP, use "127.0.0.1" instead of "localhost". If the MySQL client library tries to connect to the wrong local socket, you should set the correct path as in your PHP configuration and leave the server field blank.

http://php.net/manual/en/function.mysql-connect.php

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜