You will face a common issue with database connection when uploaded your site at servers. The error string looks like the following
PDOException: SQLSTATE[HY000]  Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’
It happens in netfirms, 1and1, godaddy etc servers. This issue can be resolved by mentioning proper host information instead of mentioning “localhost” and mentioning the port.