Results 1 to 6 of 6

Thread: php Can't connect to local MySQL server through socket

  1. #1
    krahny's Avatar
    krahny is offline x10Hosting Member
    Join Date
    Nov 2009
    Posts
    25

    Question php Can't connect to local MySQL server through socket

    My code was going fine until, for no apparent reason, this warning message appeared. I think there is something wrong with the database connection.

    Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) in /home/krahny/public_html/login.php on line 3

    Could someone please help me figure out what is wrong?

  2. #2
    apohler1 is offline x10Hosting Member
    Join Date
    Apr 2009
    Posts
    7

    Re: php Can't connect to local MySQL server through socket

    Hi,

    I had the same problem, located in my config file.
    After looking in my account I saw that localhost isn`t working anymore.
    I have needed to change localhost into mysql-stoli.x10hosting.com.

    Maybe this will fix your problem too.

    Greetings :cool:

  3. #3
    kiniela is offline x10Hosting Member
    Join Date
    Aug 2009
    Posts
    7

    Re: php Can't connect to local MySQL server through socket

    I have the same problem. Read your post but I have no idea on how to solve it :dunno:. Can you please explain it more in detail ? Thanks a lot :happysad:

  4. #4
    berzo is offline x10Hosting Member
    Join Date
    Jan 2008
    Posts
    6

    Re: php Can't connect to local MySQL server through socket

    Same problem here. Hope it gets fixed soon

  5. #5
    kiniela is offline x10Hosting Member
    Join Date
    Aug 2009
    Posts
    7

    Re: php Can't connect to local MySQL server through socket

    Ok. I have been able to solve it by myself. It is no other than to think things twice. ;)

    AS localhost is no longer valid, I have had to replace the word "localhost" by "mysql-stoli.x10hosting.com" in all my connection scripts for all the php files.

    So

    $connexion = mysql_connect ("localhost", "user", "pwd")

    now reads:

    $connexion = mysql_connect ("mysql-stoli.x10hosting.com", "user", "pwd")

    Thanks.
    Last edited by kiniela; 12-28-2009 at 09:08 AM.

  6. #6
    krahny's Avatar
    krahny is offline x10Hosting Member
    Join Date
    Nov 2009
    Posts
    25

    Talking Re: php Can't connect to local MySQL server through socket

    Thanks for the help. I have now fixed my problem and everything is working fine.

Similar Threads

  1. MYSQL Server Connection Error
    By stormprograms in forum Scripts, 3rd Party Apps, and Programming
    Replies: 5
    Last Post: 10-06-2009, 10:09 PM
  2. AMP - local testing server
    By allofus in forum Scripts, 3rd Party Apps, and Programming
    Replies: 0
    Last Post: 09-04-2009, 08:11 PM
  3. MySQL Issues Here
    By Corey in forum Service Alerts
    Replies: 304
    Last Post: 01-06-2008, 09:10 PM

Posting Permissions

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