C and PHP MySQL clients can set a connection timeout before a
connection is established to MySQL. The MySQL C API manual states about
MYSQL_OPT_CONNECT_TIMEOUT
, which is equal to PHPs
MYSQLI_OPT_CONNECT_TIMEOUT
:
MYSQL_OPT_CONNECT_TIMEOUT
Connect timeout in seconds.
From: http://dev.mysql.com/doc/refman/5.1/en/mysql-options.html
That is half of the story. The actual behaviour depends on the library you use, the operating system and the transport protocol (TCP/IP, Unix domain sockets, Windows named pipes, Shared Memory).
C users can choose between the MySQL Client Library, which ships with the MySQL server, and the …
[Read more]