Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 954
luigi Avatar asked Jan 26 '17 19:01

luigi


4 Answers

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.

like image 146
naiz0 Avatar answered Nov 15 '22 13:11

naiz0


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.

like image 28
Siraj Alam Avatar answered Nov 15 '22 13:11

Siraj Alam


Maybe your SQL server has been stopped.

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
like image 24
Abdulla Nilam Avatar answered Nov 15 '22 15:11

Abdulla Nilam


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.

like image 22
faruq ah Avatar answered Nov 15 '22 13:11

faruq ah