MySQL so called ERROR 2002 aka Can't connect to local MySQL

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hadlawp
Forum Newbie
Posts: 7
Joined: Sat Apr 24, 2010 5:31 pm

MySQL so called ERROR 2002 aka Can't connect to local MySQL

Post by hadlawp »

hi guys, i would really appreciate if anyone could help me figure out why im getting this error

i called godaddy and they said nothing is wrong with their servers,
the thing that surprises me the most is that i have been basically coping and pasting these access string all the time, and why all of the sudden just this instance doesnt work

heres the full error:

Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/content/37/6293537/html/207math/content/post.php on line 127

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/content/37/6293537/html/207math/content/post.php on line 127
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)


and here is the corresponding code

Code: Select all

$result1 = mysql_connect(***correct info***) or die(mysql_error());
$result2 = mysql_select_db(***correct info***) or die(mysql_error());
(line 126)$insert = "INSERT INTO forums (author, postLocation, inReplyToPostId, content, status) VALUES ('".$username."', '".$classbegin."', '".$id."', '".$replyId."', '".$content."', '".$status."')";
(line 127)$insert1 = mysql_query($insert) or die(mysql_error());
    
mysql_close($result1);
User avatar
DigitalMind
Forum Contributor
Posts: 152
Joined: Mon Sep 27, 2010 2:27 am
Location: Ukraine, Kharkov

Re: MySQL so called ERROR 2002 aka Can't connect to local My

Post by DigitalMind »

Are you sure /var/lib/mysql/mysql.sock exists?
Post Reply