Possible duplicate of this
I am connecting the DB using the PDO.
$DBH = new PDO('mysql:host=localhost;dbname=name','dbusername','dbpassword');
This is not working here.
I am getting the error
SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
But whatever the connection we already done in mysql_connect thats working fine.Could you please help me on this.
Some web hosting providers use custom domain names or IP addresses for MySQL connection, I would advise you first of all to check hosting manual on database connections.
Usually by creating MySQL database through control panel, you would receive example of database connection properties.