Page 1 of 1

connect error.

Posted: Tue Dec 28, 2010 8:32 pm
by rockinliam
What is this error? I can't work it out. Help appreciated.
http://mrangrytroll.com/development/rate_mate/

Code: Select all

Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/content/93/6823793/html/development/rate_mate/connect.php on line 3
Could not connect to db

Code: Select all

<?php

$db = mysql_connect("localhost","ratemate","PASSWARD") or die("Could not connect to db");
if(!$db)
die("no db");
if(!mysql_select_db($db , "ratemate"))
die("No Database Selected");

?>

Re: connect error.

Posted: Tue Dec 28, 2010 9:28 pm
by SpiritWebb

Code: Select all

<?php

$db = mysql_connect("localhost","ratemate","PASSWARD") or die("Could not connect to db");

Try changing the quotes to the single ' and see what happens...also adding the mysql_error() to it, will help debug with a better understanding of whats going on here if it fails again

Code: Select all

<?php

$db = mysql_connect('localhost', 'ratemate', 'PASSWARD') or die('Could not connect to db: ' . mysql_error());


Re: connect error.

Posted: Wed Dec 29, 2010 8:27 am
by Chris
By the looks of it your MySQL server is running on a different port. You'll have to find out what port, or change it.

Code: Select all

mysql_connect("localhost:port", "username", "password");