mysqli_real_connect(): (HY000/2002): No such file or directory
mysqli_real_connect(): (HY000/2002): No such file or directory
PhpMyAdmin error on MacOS. I want answer I really have no idea what I need to do to resolve this.
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:
This worked for me.
Locate config.sample.inc.php
Change
$cfg['Servers'][$i]['host'] = 'localhost';
into
$cfg['Servers'][$i]['host'] = '127.0.0.1';
Save.
Then rename the file and remove sample from the name.
Solution 3:
I'm trying this before
cd /opt/lampp/phpmyadmin
Then
gedit config.inc.php
Find this
$cfg['Servers'][$i]['host'] =
If there is localhost
change it to 127.0.0.1
Note : if there is '//' remove // before
$cfg['Servers'][$i]['host']
I checked again http://localhost/phpmyadmin/
Mysqli said:
"phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server."
I'm opening again config.inc.php
and I found
$cfg['Servers'][$i]['password'] =
Fill the password with your password
It worked for me. It may work for you too.
Solution 4:
Maybe your SQL server has been stopped
sudo /etc/init.d/mysql start
or
sudo service mysqld start
and useservice mysql status
to check status
EDIT adding from comments:
Use:
sudo systemctl enable mysql
to keep running MySQL.