Page 1 of 1

mysql_connect() problem

Posted: Fri Nov 13, 2009 3:31 am
by jlackyashdya
hi,

i m new to php- mysql .

i have write simple code for making connection to the databse :
<?php
$link = mysql_connect('localhost', 'abc', 'abc123'); // (which is databse username and password)
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>

but its giving me following warning...
Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /misc/34/000/110/762/7/user/web/rollball.org/test.php on line 4
Could not connect: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

please help me...

Thanks a lot

Re: mysql_connect() problem

Posted: Fri Nov 13, 2009 3:55 am
by onion2k
MySQL isn't running (or it's on a port that isn't standard). Talk to your hosting company.

Re: mysql_connect() problem

Posted: Fri Nov 13, 2009 5:06 am
by jlackyashdya
Thanks :)