Can't connect to local MySQL server through socket

software development

#1

I have installed Magento-Everything was running great, yesterday Suddenly It started giving Error-
Could not connect: Can’t connect to local MySQL server through socket
’/var/run/mysqld/mysqld.sock’ (2)

What could be the problem? I have hosted a test website also on dreamhost, but this is happening only on main website not on test. I found a file my.cnf in /etc/mysql/my.cnf there is a line socket = /var/run/mysqld/mysqld.sock but this directory doesnt exist. But In that case none of the databases should work on other websites and I should receive same error everywhere.

It is a magento website and admin panel is working fine. that is also strange.