MySQL Error - How do I solve this?

Alright I have a connect script and when I test it, I get this error message

Could not connect: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

For the sake of it, here is the connect script.

$host = "localhost";
$user = "david";
$pass = "*****";
$link = mysql_connect($host, $user, $pass);
if (!$link) {
   die('Could not connect: ' . mysql_error());
}
mysql_select_db("davidwin_admin") or die(mysql_error());