I am trying to put a symfony project on a client server for production. The website worked fine on our company's server, but now i have this error :
500 | Internal Server Error | Doctrine_Connection_Exception
PDO Connection Error: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Here is the database.yml :
all:
doctrine:
class: sfDoctrineDatabase
param:
dsn: 'mysql:host=localhost;dbname=24DLJLRR1'
username: xxxxxxxxxx
password: xxxxxxxxxx
And moreover if i try to test a mysql_connect :
<?php
mysql_connect("localhost", "xxxxxxxxxx", "xxxxxxxxxx");
mysql_select_db("24DLJLRR1");
$answer = mysql_query("SELECT * FROM video_games") or die(mysql_error());
echo 'hello world'
mysql_close();
?>
It works fine (it displays the 'hello world'). Someone knows where this come from ?
Thank you very much.
As the comment suggests it may be as easy as a forgotten "host=" right in front of the localhost string. Another thing to check for is that the mysql server in questions actually is configured to allow connections over the socket as opposed to using port 3306 which is the default TCP port.