I recently reactivated my (Shared Hosting) DreamHost account, and I’m trying to develop a relatively simple PHP program that needs to retrieve data from a mysql database. However, I keep getting this error:
ERROR: SQLSTATE[HY000]  Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)
My code is as follows:
$this->database = new PDO( "mysql:host=" . $host . ";dbname=" . $database, $dbUser, $dbPassword);
I’ve used the values of $host, $dbUser, and $dbPassword to log in to myPHPAdmin, so I know they’re right. I’ve also double-checked the database name. Any idea what I’m doing wrong?