I work on Ubuntu 12.04 with MySQL and LAMPP. I run some commands in order to make a new user and gain extra privileges for executing "chmod" and "exec" commands in PHP.
After the set up of the new user, when I try to log in to my site I get the error below:
Connection failed: SQLSTATE[HY000] 
2002 - No such file or directory The server is not responding (or the local server's socket is not correctly configured).
You can try:
chown www-data:www-data /var/www -R chmod 755 /var/www -R addgroup your_user www-data
chown vaggos:vaggos /opt/lampp -R chmod 755 /opt/lampp -R addgroup your_user vaggos
For temp folder:
chown vaggos:vaggos /temp -R chmod 755 /temp -R
chown www-data:www-data /temp -R chmod 755 /temp -R
Check this for more detailed information: How to fix permission of htdocs in Ubuntu
If this answer was usefull, give +1 ;)