Fix MySQL blocking forever on read

MySQL will block forever on read even the connection died. Setting the connect timeout does not help.

If you use threaded queries and you try to unload a plugin in this state, the server will freeze.

You may test this by blocking mysql traffic and then typing sm_reloadadmin and waiting for a minute or two.

sudo iptables -A INPUT -p tcp --sport 3306 -j DROP

You can then remove the block. If you attempt to type sm_reloadadmins or some other DB using plugin it will never reconnect. With this patch, it seems to reconnect in a few seconds.

I am not sure if a write timeout is necessary because it should only take a few seconds to detect a broken socket if it is being written to because it will expect an ACK very soon.