PHP MySql Errors

Discussion in 'PHP' started by shergill, Aug 10, 2007.

  1. #1
    Hi guys.. Lately; I have been getting a lot of these errors on my site.

    Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in

    The pages load fine sometimes; but then sometimes I get the above error.. Do you know why I might be having trouble connecting to mySql??
     
    shergill, Aug 10, 2007 IP
  2. Galen

    Galen Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    if it works sometimes then it's probably a host issue. contact your hsot and let them know you are having issues
     
    Galen, Aug 10, 2007 IP
  3. sarav_dude

    sarav_dude Peon

    Messages:
    10
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Fews thing can be possible :

    1. if you got this error sometimes then it is your host problem.
    2. if you got this error always , then your check your first parameter of the mysql_connect()
    :)
     
    sarav_dude, Aug 10, 2007 IP
  4. shergill

    shergill Peon

    Messages:
    138
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I am getting this error 'sometimes'.. I will let the host know.

    Thanks!
     
    shergill, Aug 10, 2007 IP
  5. shergill

    shergill Peon

    Messages:
    138
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Turns out I was not closing a connection in an Ajax function.. word to the wise!
     
    shergill, Aug 10, 2007 IP