wamp 服务器中的服务器没有响应(或本地 MySQL 服务器的套接字未正确配置)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10178547/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 12:58:52  来源:igfitidea点击:

The server is not responding (or the local MySQL server's socket is not correctly configured) in wamp server

mysql

提问by Charmie

I am currently getting this error in my phpmyadmin:

我目前在我的 phpmyadmin 中收到此错误:

2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)

2002 - 服务器没有响应(或者本地 MySQL 服务器的套接字没有正确配置)

I tried googling and give each solutions i found a try. Unfortunately, nothing worked for me.

我尝试使用谷歌搜索并尝试我找到的每个解决方案。不幸的是,没有什么对我有用。

By the way, I am using wamp server.

顺便说一下,我正在使用 wamp 服务器。

Below is my configuration file of config.inc.php from C:\wamp\apps\phpmyadmin3.2.0.1.

下面是我在 C:\wamp\apps\phpmyadmin3.2.0.1 中的 config.inc.php 配置文件。

<?php

/* Servers configuration */
$i = 0;

/* Server: localhost [1] */
$i++;
$cfg['Servers'][$i]['verbose'] = 'localhost';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '/tmp/mysql.sock';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['AllowNoPassword'] = true;

/* End of servers configuration */

$cfg['DefaultLang'] = 'en-utf-8';
$cfg['ServerDefault'] = 1;
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';

?>

采纳答案by Satya

mysql default port is 3306 can you try putting it and then try

mysql默认端口是3306你可以试试把它放好然后试试

回答by Paul Gobée

There are possible solutions here: http://forums.mysql.com/read.php?35,64808,254785#msg-254785and here: http://forums.mysql.com/read.php?35,23138,254786#msg-254786

这里有可能的解决方案:http: //forums.mysql.com/read.php?35,64808,254785#msg- 254785和这里:http: //forums.mysql.com/read.php?35,23138, 254786#msg-254786

All of these are config settings. In my case I have two computers with everything in XAMPP synced. On the other computer phpMyAdmin did start normally. So the problem in my case seemed to be with the specific computer, not the config files. Stopping firewall didn't help.

所有这些都是配置设置。就我而言,我有两台计算机,XAMPP 中的所有内容都已同步。在另一台计算机上 phpMyAdmin 确实正常启动。所以我的问题似乎出在特定的计算机上,而不是配置文件。停止防火墙没有帮助。

Finally, more or less by accident, I bumped into the file:

最后,或多或少偶然,我撞到了文件:

...path_to_XAMPP\XAMPP...\mysql\bin\mysqld-debug.exe

...path_to_XAMPP\XAMPP...\mysql\bin\mysqld-debug.exe

Doubleclicking that file miraculously gave me back PhpMyAdmin. Posted here in case anyone might be helped by this too.

双击该文件奇迹般地让我回到了 PhpMyAdmin。发布在这里以防任何人也可能因此而有所帮助。

回答by Balkrishna

I face the same problem and changing

我面临同样的问题并且正在改变

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

to

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

Solved this issue.

解决了这个问题。

回答by Leads Olutions

I had a similar issues fresh install and same error surprising. Finally I figured out it was a problem with browser cookies...

我有一个类似的问题,全新安装和同样的错误令人惊讶。最后我发现这是浏览器cookie的问题......

  1. Try cleaning your browser cookies and see it helps to resolve this issue, before even trying any configuration changes.

  2. Try using XAMPP Control panel "Admin" button instead of usual http://localhostor http://localhost/phpmyadmin

  3. Try direct link: http://localhost/phpmyadmin/main.phpor http://127.0.0.1/phpmyadmin/main.php

  4. Finally try this: http://localhost/phpmyadmin/index.php?db=phpmyadmin&server=1&target=db_structure.php

  1. 在尝试任何配置更改之前,尝试清理您的浏览器 cookie 并查看它是否有助于解决此问题。

  2. 尝试使用 XAMPP 控制面板的“管理”按钮而不是通常的http://localhosthttp://localhost/phpmyadmin

  3. 尝试直接链接:http://localhost/phpmyadmin/main.phphttp://127.0.0.1/phpmyadmin/main.php

  4. 最后试试这个: http://localhost/phpmyadmin/index.php?db=phpmyadmin&server=1&target=db_structure.php

Somehow if you have old installation and you upgraded to new version it keeps track of your old settings through cookies.

不知何故,如果您有旧安装并升级到新版本,它会通过 cookie 跟踪您的旧设置。

If this solution helped let me know.

如果此解决方案有帮助,请告诉我。

回答by Chad Pjontek

I use XAMPP and had the same error. I used Paul Gobéesolution above and it worked for me. I navigated to C:\xampp\mysql\bin\mysqld-debug.exeand upon starting the .exemy Windows Firewall popped up asking for permission. Once I allowed it, it worked fine. I would have commented under his post but I do not have that much rep yet... sry! Just wanted to let everyone know this worked for me as well.

我使用 XAMPP 并有同样的错误。我使用了上面的Paul Gobée解决方案,它对我有用。我导航到C:\xampp\mysql\bin\mysqld-debug.exe并在启动时.exe弹出我的 Windows 防火墙请求许可。一旦我允许它,它就可以正常工作。我会在他的帖子下发表评论,但我还没有那么多代表......对不起!只是想让大家知道这对我也有用。

回答by Jonathan

If you use MAMP, make sure it's started. :)

如果您使用 MAMP,请确保它已启动。:)

I just ran into this problem, and after starting MAMP the error went away. Not my finest moment.

我刚遇到这个问题,启动 MAMP 后,错误消失了。不是我最美好的时刻。