#2002-服务器没有响应(或本地MySQL服务器的套接字未正确配置) [英] #2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)
问题描述
我无法访问PHPMyAdmin.当我想去那里时,出现此错误:
I can't access to PHPMyAdmin. when i want to go there, i got this error:
#2002-服务器没有响应(或本地MySQL服务器的套接字未正确配置)
#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)
我搜索了此错误,但无法清除.
I googled this error but it don't clear.
我试图通过以下代码知道哪个端口是打开的:
I try to know that which port is open by this code :
pgrep mysql
当mysql运行时,两个端口打开.
two ports are open when mysql is running.
我想在我的本地主机中访问PHPMyAdmin.我正在使用Ubuntu OS
I want to access to PHPMyAdmin in my localhost. I am using Ubuntu OS
推荐答案
在Ubuntu中,默认情况下mysql
不监听TCP/IP连接.它只是使用本地套接字.
In Ubuntu, by default mysql
is not listening to TCP/IP connections. It just uses a local socket.
当前本地套接字在/etc/mysql/my.cnf
中配置.如果打开此文件,则应该找到类似于以下内容的文件:
The current local socket is configured in /etc/mysql/my.cnf
. If you open this file, you should find something similar to:
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
您应该做的只是打开PHPMyAdmin
的配置文件(config.inc.php
)并更改套接字地址.也许您的PHPMyAdmin上没有本地套接字配置,或者可能有所不同.该文件应包含以下行(当然,将地址修改为您在my.cnf
上找到的地址):
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
):
$cfg['Servers'][$i]['socket'] = '/var/run/mysqld/mysqld.sock';
这篇关于#2002-服务器没有响应(或本地MySQL服务器的套接字未正确配置)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!