'Magento Installation SQLSTATE[HY000] [2002] No such file or directory error

I am a newbie at LAMPP enviroment and I installed XAMPP for installing Magento.

Everthing was going fine till "Add database" step of Magento installation. I created database which is called 'magento' from phpMyAdmin and I am getting this error. I made many searches on it most of people talked about connection type.

I couldn't handle that point. Is there anyone who know how to figure socketing for magento.

To see screenshoot please click here.Thank you from now.



Solution 1:[1]

I handled the problem by changing 'localhost' to '127.0.0.1'.

First go to folder where you installed the xampp and find out config.inc.php. (mine is /opt/lamp/phpmyadmin/config.inc.php.

After take a look to $cfg['Servers'][$i]['host'] = '127.0.0.1';.
If it is localhost change by '127.0.0.1'

Solution 2:[2]

Just try to restart the MySql DB service

service mysql start

It worked for me..

Solution 3:[3]

for mac with MAMP, it will work

ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock

Solution 4:[4]

Just change 'localhost' to '127.0.0.1' if you are working in your local machine

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 An?l Selvi
Solution 2 Muralidharan.rade
Solution 3 Rohit Kaushik
Solution 4 Nikunj Padhiyar