I first encountered the same problem when I installed drupal onto a mysql 5.0 instance.
The standard instal (which for me was in fact an install from source) of MySQL places the mysqld.sock file in the tmp directory. It seems that often, other software expects to see it in the /var/run/mysqld folder.
The solution is to either change the setting in the my.cnf file
socket = /tmp/mysql.sock
or to create the required symlink.
ln -s /tmp/mysql.sock /var/run/mysqld/mysql.sock
[you will need to be root, so use sudo on debian based systems]
I use the second solution as it enables you to be place a link to the file wherever a bit of software is expecting it to be.
Signup for our newsletter, for the latest news and product updates