XAMPP : Mysql # 2002 – No such file or directory

After installing XAMPP in CentOS ,I tried to open the phpmyadmin of XAMPP.
I opened the phpmyadmin URL in web browser and found the below given error.

Error
MySQL said: Documentation
#2002 – No such file or directory
The server is not responding (or the local server’s socket is not correctly configured).

XAMPP phpmyadmin

Later, I noticed that mysql service was not running.You can check the mysql status by running below given command.

netstat -tanp|grep mysql

To solve this error, run or restart the mysql service from XAMPP stack

Run the command to restart the mysql service from XAMPP

/opt/lampp/lampp stopmysql
/opt/lampp/lampp startmysql

Open the XAMPP phpmyadmin URL in web browser

Open the web browser and type the XAMPP server phpmyadmin url.It should be working now
for eg. Replace 192.168.56.102 with your XAMPP system ip address.

http://192.168.56.102/phpmyadmin

xampp phpmyadmin

Another troubleshooting step for XAMPP phpmyadmin error “# 2002 – No such file or directory”

I also found that in some cases XAMPP’s php.ini file, value for mysql.default_socket parameter is wrong. The system admin may give wrong path of mysql.sock path in mysql.default_socket parameter.

If we keep the parameter mysql.default_socket value blank,it will take default value.

Hence, for troubleshooting purpose,keep the mysql.default_socket value blank.
Below given is the reference from my system.
Here I have used grep command to show the particular paramater in php.ini file.

[root@localhost ~]# grep -w mysql.default_socket /opt/lampp/etc/php.ini
mysql.default_socket=
[root@localhost ~]#

4 thoughts on “XAMPP : Mysql # 2002 – No such file or directory”

  1. it was working after running the above command but after i restart the laptop,
    it was not working ! and when i try to type again the given command the problem still accour !
    pleeease help me

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.