phpmyadmin - error 2002 - on Mac

2019-04-06 02:18发布

问题:

I'm currently using Mac, and the running OS version is El Capitan. The web root is /Users/username/Sites.

I downloaded, extracted the phpmyadmin and moved the directory to the root folder, and I managed to get to the log in screen. But when I try to log in, it shows a message like this.

#2002 - No such file or directory<br />The server is not responding (or the local server's socket is not correctly configured).

I checked out if MySQL was turned off, but it was on so it doesn't have to do with that. Does anybody know how to solve out this matter?

回答1:

So the solution was fairly simple for my case.

After reading some articles like this, I viewed my phpmyadmin directory to find the config.inc.php file. This is what I still haven't figured out but there was no file with the same name.

Instead, the file with the closest name was config.sample.inc.php, so I changed its file name and changed $cfg['Servers'][$i]['host'] = 'localhost'; to $cfg['Servers'][$i]['host'] = '127.0.0.1';. Now I can log in with the phpmyadmin account.



回答2:

Got the same error after upgrading mariadb through homebrew upgrade on OS X Siera 10.12.5.

Turns out that a config directory was missing:

mysql: Can't read dir of '/usr/local/etc/my.cnf.d' (Errcode: 2 "No such file or directory")

Simply creating this directory solves the issue (no need to restart the mariadb daemon):

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

Wait a few seconds and retry to connect:

$ mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 10.2.6-MariaDB Homebrew


回答3:

This worked for me.

  1. brew services mysql stop
  2. Go to Xampp and restart mysql service.