Forum Moderators: coopster

Message Too Old, No Replies

mysql connection error

         

kumarsena

10:54 am on Nov 24, 2004 (gmt 0)

10+ Year Member



ive ben trying to install a classifieds script, but get this error:

Warning: mysql_connect(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/1/e/erudi/www/classifieds_1_3/gorum/dbproperty.php on line 300
Mysql connection failed. Host: , Username:

not sure if this has anything to do with php, but any sugesstions appreciated.

orion_rus

11:41 am on Nov 24, 2004 (gmt 0)

10+ Year Member



You had to add the user root accessing from 127.0.0.1 rather than localhost... and connect via that user...

for some reasong the localhost was not working the way that it should....

might have to check the hosts file on the box or something...

kumarsena

5:35 pm on Nov 26, 2004 (gmt 0)

10+ Year Member



this is a code bit from the file that produces teh error. the code is complex and i cannot get my head aroundit...


function connectDb($host="",$user="",$pw="",$db="")
{
[strong] $ret = mysql_connect($host, $user, $pw);[/strong]
if (!$ret) {
$txt="Mysql connection failed. Host: $host, Username: $user";
handleError($txt);
}
$ret=mysql_select_db($db);
if (!$ret) {
$txt="Mysql select database failed. Database name: $db";
handleError($txt);
}
}

line 300 in bold

any suggestions appreciated

kumar

jatar_k

6:19 pm on Nov 26, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



have you made sure that the call to connectDb has the correct values for $host,$user,$pw,$db?

I would look at the actual line calling this function first

kumarsena

4:19 pm on Nov 27, 2004 (gmt 0)

10+ Year Member



hmm, ill ahve a look

tnx