close

[Solved] mysqli_real_connect(): (HY000/2002): No such file or directory

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error mysqli_real_connect(): (HY000/2002): No such file or directory in php. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How mysqli_real_connect(): (HY000/2002): No such file or directory Error Occurs?

Today I get the following error mysqli_real_connect(): (HY000/2002): No such file or directory in php.

How To Solve mysqli_real_connect(): (HY000/2002): No such file or directory Error ?

  1. How To Solve mysqli_real_connect(): (HY000/2002): No such file or directory Error ?

    To Solve mysqli_real_connect(): (HY000/2002): No such file or directory Error If you used Mac OS and Brew try this:
    mkdir /usr/local/etc/my.cnf.d

  2. To Solve mysqli_real_connect(): (HY000/2002): No such file or directory Error

    To Solve mysqli_real_connect(): (HY000/2002): No such file or directory Error If you used Mac OS and Brew try this:
    mkdir /usr/local/etc/my.cnf.d

Solution 1

change localhost to 127.0.0.1 in /etc/phpmyadmin/config.inc.php

$cfg['Servers'][$i]['host'] = '127.0.0.1';

The reason for this is that pma tries to connect to the mysql.socket if you use localhost. If you use 127.0.0.1 PMA makes a TCP connection which should work.

Solution 2

If you used Mac OS and Brew try this:

mkdir /usr/local/etc/my.cnf.d

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read

Leave a Comment