var.php error

Discussion in 'MySQL' started by kikuyaar123, Oct 20, 2008.

Thread Status:
Not open for further replies.
  1. #1
    hi freinds,
    i have a big problem...
    when i am logging in to my site it says me this

    "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)"

    please can anyone tell me how to fix it?????
     
    kikuyaar123, Oct 20, 2008 IP
  2. Krnl

    Krnl Peon

    Messages:
    60
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    0
    #2
    Your mysqld doesn't seem to be listening on the local socket, so loopback connections to the server aren't making it there. Try changing your server to the domain name upon which the server is running. i.e. change 'localhost' to 'yourhost.com' in the mysql_host portion of your script. This will tell the script to connect through the TCP port instead of the local socket.

    That's a workaround until you get the socket working...

    While the mysql server is running, run the command 'ls -l /var/run/mysqld/mysqld.sock' and see if there's a file there. If not, try the command 'locate mysql.sock' and see if the socket exists elsewhere. If the ls command shows anything, copy and paste it here.

    You can also test your mysqld from the command line. Try the following. (to exit from a mysql shell, type \q<enter>

    To connect to the socket:
    mysql -uroot -p localhost

    If it gives you a prompt, then your mysqld is accepting socket connections and there's a problem in your script.

    On the flip side, using the tcp side of the mysqld:
    mysql -uroot -p yourhostname.com

    good luck!
     
    Krnl, Oct 21, 2008 IP
Thread Status:
Not open for further replies.