I have the same issues described here: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
but, I am certain my credentials are in correctly.
I am using a hosting company and ( tsohosts.co.uk ) and assume that MySql starts automatically.
I'm not sure what to check next. Is there any way to get more details about the "or die" phrase.
Here is my code:
$dbc = mysqli_connect("localhost","CorrectUser","CorrectPass",CorrectDB")
or die ('No can do');
$query = "INSERT INTO users(firstName,lastName,username,password,email,dateJoin,school,level) "
." VALUES ('value','value','value','value','value', NOW(),'value','Not yet set')";
mysqli_query($dbc, $query) or die ("I couldn't get it in!");
mysqli_close($dbc);
?>
and the error is
Warning: mysqli_connect() [function.mysqli-connect]: (HY000/2002): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in ../testdb.php on line 16
No can do
Do I have to do something else start MySQL within the PHP script?