I had encountered the problem for executing mysql_query (using c++) and the query hang for several minutes then it will detects mysql server has gone away. This problem only occured when mysql server has shut down or LAN is down. I am wondering are there any way to shorten the timeout to detect for mysql down?
During mysql_real_connect, I use connect timeout for 2 seconds and it works. But mysql_query does not have this parameters.