Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specifying protocol in mysql connect (PHP)

Tags:

php

mysql

tcp

How do you specify protocol = TCP in myql_connect()?

like image 549
algorithmicCoder Avatar asked Jun 16 '11 01:06

algorithmicCoder


1 Answers

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

like image 85
deceze Avatar answered Nov 07 '22 16:11

deceze