The default mysql connect timeout is 60. So you should get the message "no connection" after 60 seconds. Did you wait that long?
If you want it faster, you can set the timeout to for example 3 seconds like this:
Do this before mysql_connect.