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.
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.
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.
sudo /etc/init.d/mysql start
or
sudo service mysqld start # older versions
sudo service mysql start # latest versions
And use service mysql status
to check the status
To keep running MySQL.
Use:
sudo systemctl enable MySQL # older versions
sudo systemctl start mysql.service # latest versions
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With