Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2009

    Unanswered: Can't connect to MySQL server on 'server_IP' (99)


    My website resides on one server and it connects to a remote MySql server.

    Intermittently, I am getting following error:

    Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL
    server on 'server_IP' (99) in /home/user/public_html/include/ on
    line 18
    Can't connect to MySQL server on '' (99)

    Line 18 contains connection to the DB server:

    $db_h = mysql_connect(DB_HOST, DB_USER, DB_PASS)

    This error comes up randomly, but definitely a lot more during the times when the website traffic is heavier and more users are browsing the site.

    I searched everywhere but so far did not figure it out...

    Any ideas?


  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    so what was the MySQL error.
    I'm guessing its going to be something like
    "to many connections"

    PHP Code:
    $cnn=@mysql_connect(HOST,UID1,PWD1) or die(echo mysql_errno().": ".mysql_error());
    $dbr=@mysql_select_db(DBN,$cnn) or die (echo mysql_errno().":".mysql_error());
    $strSQL "select my,column,list from mytable"
    $ResultSet=@mysql_query($strSQL,$cnn) or die (echo mysql_errno().": ".mysql_error()." SQL is":.$strSQL)); 
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Sep 2009
    When that happens, try to login to shell and type netstat -n. If you get a lot of open connection in TIME_WAIT status, it may be due to you running out of outgoing port.

    Check this link : MySQL Lists: mysql: Re: error 99(?) : can't connect to MySQL server.

    You may want to try some kind of DB connection pooling or change it to mysql_pconnect() instead of mysql_connect().

  4. #4
    Join Date
    Sep 2009
    Thanks for your suggestions.

    I actually fixed it by lowering the connection timeout from 30 to 10.

  5. #5
    Join Date
    Jun 2009
    Recently during my evaluations, I had similar issues with MySQL. I decided to give Raima RDM Server instead and it worked...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts