php #2002 - 服务器没有响应(或者本地 MySQL 服务器的套接字没有正确配置)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23885436/
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
#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)
提问by Omid Zamani
I can't access to PHPMyAdmin. when i want to go there, i got this error:
我无法访问 PHPMyAdmin。当我想去那里时,我收到了这个错误:
#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)
#2002 - 服务器没有响应(或者本地 MySQL 服务器的套接字没有正确配置)
I googled this error but it don't clear.
我用谷歌搜索了这个错误,但不清楚。
I try to know that which port is open by this code :
我试着知道这个代码打开了哪个端口:
pgrep mysql
two ports are open when mysql is running.
mysql 运行时有两个端口是打开的。
I want to access to PHPMyAdmin in my localhost. I am using Ubuntu OS
我想在我的本地主机中访问 PHPMyAdmin。我正在使用 Ubuntu 操作系统
回答by Oscar Pérez
In Ubuntu, by default mysql
is not listening to TCP/IP connections. It just uses a local socket.
在 Ubuntu 中,默认情况下mysql
不侦听 TCP/IP 连接。它只使用本地套接字。
The current local socket is configured in /etc/mysql/my.cnf
. If you open this file, you should find something similar to:
当前本地套接字在/etc/mysql/my.cnf
. 如果您打开此文件,您应该会发现类似以下内容:
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
What you should do is just to open PHPMyAdmin
's config file (config.inc.php
) and change the socket address. Maybe there's no local socket configuration on your PHPMyAdmin, or maybe it is different. This file should contain a line like (of course, adapt the address to what you found on my.cnf
):
您应该做的只是打开PHPMyAdmin
的配置文件 ( config.inc.php
) 并更改套接字地址。也许您的 PHPMyAdmin 上没有本地套接字配置,或者可能不同。该文件应包含如下一行(当然,请根据您在 上找到的地址调整地址my.cnf
):
$cfg['Servers'][$i]['socket'] = '/var/run/mysqld/mysqld.sock';
回答by Abhijeet K.
Steps just to run the mysql server after crash.
崩溃后运行mysql服务器的步骤。
** Worked on wamp server **
** 在 wamp 服务器上工作 **
- Check the
{System name}.err
file inside your mysql data directory. - From the log find out the databases causing issues
- Cut them out from the data directory (keep in some safe places).
- Start mysql service
- 检查
{System name}.err
mysql 数据目录中的文件。 - 从日志中找出导致问题的数据库
- 从数据目录中删除它们(保存在一些安全的地方)。
- 启动mysql服务
回答by Darkcoder
回答by mokoth
This means that mysql server is not started. This is very simply if you are using wamp left click the wampserver icon then mysql then services then install service after that restart wamp and the problem is solved
这意味着mysql服务器没有启动。这很简单,如果您使用 wamp 左键单击 wampserver 图标,然后单击 mysql,然后单击服务,然后在重新启动 wamp 后安装服务,问题就解决了