php Can't connect to local MySQL server through socket

krahny

New Member
Messages
25
Reaction score
0
Points
0
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?
 

apohler1

New Member
Messages
7
Reaction score
0
Points
0
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:
 

kiniela

New Member
Messages
7
Reaction score
0
Points
0
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:
 

kiniela

New Member
Messages
7
Reaction score
0
Points
0
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:

krahny

New Member
Messages
25
Reaction score
0
Points
0
Thanks for the help. I have now fixed my problem and everything is working fine.:biggrin:
 
Top