如何解决 Ubuntu 中的 XAMPP 1.7.7 - PHPMyAdmin - MySQL 错误 #2002

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10426501/
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 13:14:05  来源:igfitidea点击:

How to Solve the XAMPP 1.7.7 - PHPMyAdmin - MySQL Error #2002 in Ubuntu

mysqlubuntuphpmyadminxamppmysql-error-2002

提问by CompilingCyborg

I have been through lots of forums and checked various posts on similar topic but non seems to work out for me.

我浏览了很多论坛并查看了有关类似主题的各种帖子,但似乎对我不起作用。

I have freshly installed XAMPP 1.7.7 on my Ubuntu 11.10 Operating system. Everything is running except for the phpMyAdmin.

我在我的 Ubuntu 11.10 操作系统上新安装了 XAMPP 1.7.7。除了 phpMyAdmin 之外,一切都在运行。

Upon hitting: http://localhost/phpmyadmin, I am getting the following error:

点击后:http://localhost/phpmyadmin,我收到以下错误:

MySQL said:

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

Connection for controluser as defined in your configuration failed.

MySQL 说:

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

Connection for controluser as defined in your configuration failed.

When i am starting the services with: sudo /opt/lampp/lampp start
I am getting the following:

当我使用以下命令启动服务时: sudo /opt/lampp/lampp start
我得到以下信息:

XAMPP: Another web server daemon is already running.
XAMPP: Another MySQL daemon is already running.
XAMPP: Another FTP daemon is already running.
XAMPP for Linux started.

XAMPP:另一个 Web 服务器守护程序已在运行。
XAMPP:另一个 MySQL 守护进程已经在运行。
XAMPP:另一个 FTP 守护程序已在运行。
XAMPP for Linux 启动。

Any suggestions would be greatly appreciated.

任何建议将不胜感激。

回答by CompilingCyborg

It turns out that the solution is to stop all the related services and solve the “Another daemon is already running” issue.

事实证明,解决方案是停止所有相关服务并解决“Another daemon is already running”问题。

The commands i used to solve the issue are as follows:

我用来解决这个问题的命令如下:

sudo /opt/lampp/lampp stop              
sudo /etc/init.d/apache2 stop    
sudo /etc/init.d/mysql stop

Or, you can also type instead:

或者,您也可以输入:

sudo service apache2 stop
sudo service mysql stop

After that, we again start the lampp services:

之后,我们再次启动lampp服务:

sudo /opt/lampp/lampp start

Now, there must be no problems while opening:

现在,打开时一定没有问题:

http://localhost                  
http://localhost/phpmyadmin

回答by brucenan

  1. Open config.default.phpfile under phpmyadmin/libraries/
  2. Find $cfg['Servers'][$i]['host'] = 'localhost'; Change to $cfg['Servers'][$i]['host'] = '127.0.0.1';
  3. refresh your phpmyadmin page, login
  1. 打开phpmyadmin/libraries/ 下的config.default.php文件
  2. 找到 $cfg['Servers'][$i]['host'] = ' localhost'; 更改为 $cfg['Servers'][$i]['host'] = ' 127.0.0.1';
  3. 刷新你的 phpmyadmin 页面,登录

回答by Michele

At each point in these instructions, check to see if the problem is fixed. If so, great! Otherwise, continue.

在这些说明中的每个点,检查问题是否已解决。如果是这样,太好了!否则,继续。

  1. Get to Services. (I was able to right click the Apache launch icon to get there.)
  2. Scroll down to MySQL. Click to start. This will get rid of the #2002 error. Now you'll have a new error:
  1. 进入服务。(我可以右键单击 Apache 启动图标到达那里。)
  2. 向下滚动到 MySQL。点击开始。这将摆脱#2002 错误。现在你会有一个新的错误:

#1045 - Access denied for user 'root'@'localhost' (using password: NO)

#1045 - 用户 'root'@'localhost' 访问被拒绝(使用密码:NO)

  1. Edit the C:\wamp\apps\phpmyadmin3.5.1\config.inc.phpfile, changing $cfg['Servers'][$i]['extension'] = 'mysqli';to instead be= 'mysql'
  2. Open Services again and Stop MySQL
  3. While in Services, Start wampmysqld
  1. 编辑C:\wamp\apps\phpmyadmin3.5.1\config.inc.php文件,$cfg['Servers'][$i]['extension'] = 'mysqli';改为改为= 'mysql'
  2. 再次打开服务并停止 MySQL
  3. 在服务中,启动 wampmysqld

This is convoluted, I know, but that's what worked for me. Some posts may say you need a password in the config file, but you don't. Mine is still ""

这很复杂,我知道,但这对我有用。有些帖子可能会说您需要在配置文件中输入密码,但您不需要。我的还是“”

Hope this helps.

希望这可以帮助。

回答by Rajan

The problem might be with service mysql-server and apache2 running while system start. You can do the following.

问题可能出在系统启动时服务 mysql-server 和 apache2 正在运行。您可以执行以下操作。

sudo /opt/lampp/lampp stop

To stop already running default services

停止已经运行的默认服务

sudo service apache2 stop
sudo service mysql  stop

To remove the services completely, so that they won't create problem in next system-restart, If you are in ubuntu(debian)

完全删除服务,以便它们不会在下次系统重启时产生问题,如果您使用的是 ubuntu(debian)

sudo apt-get remove apache2
sudo apt-get remove mysql-server

If you are in redhat or other, You could use yumor similar command to uninstall the services

如果您使用的是 redhat 或其他,您可以使用yum或类似的命令来卸载服务

Then start the lampp again

然后再次启动lampp

sudo /opt/lampp/lampp start

Also, don't install mysql-server in the system, because it might start in system start-up, occupy the port, and create problem for mysql of lampp.

另外,不要在系统中安装mysql-server,因为它可能会在系统启动时启动,占用端口,给lampp的mysql造成问题。

回答by Hemanta Nandi

Go to phpMyAdmin/config.inc.phpedit the line

转到phpMyAdmin/config.inc.php编辑行

$cfg['Servers'][$i]['password'] = '';

to

$cfg['Servers'][$i]['password'] = 'yourpassword';

This problem might occur due to setting of a password to root, thus phpmyadmin is not able to connect to the mysql database.

这个问题可能是因为设置了root密码,导致phpmyadmin无法连接mysql数据库。

And the last thing change

最后一件事改变了

$cfg['Servers'][$i]['extension'] = 'mysql';

to

$cfg['Servers'][$i]['extension'] = 'mysqli';

Now restart your server. and see.

现在重新启动您的服务器。看看。

回答by Pragya

Go to config.inc.php file using terminal by typing the following:

使用终端通过键入以下内容转到 config.inc.php 文件:

sudo gedit /opt/lampp/phpmyadmin/config.inc.php

The file will open in gedit.

该文件将在 gedit 中打开。

Now open the file and edit

现在打开文件并编辑

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

to

$cfg['Servers'][$i]['auth_type'] = 'cookie';

and keep the username as: rootpassword:

并将用户名保持为:root密码:

Also make sure that the lines with username and password are not commented:

还要确保没有注释带有用户名和密码的行:

//$cfg['Servers'][$i]['user'] = 'root'; //$cfg['Servers'][$i]['password'] = '';

Make sure that //is removed from the above lines.

确保//从上述行中删除。

回答by Snaily

I stopped MySQL sudo service mysql stopand then started xammp sudo /opt/lampp/lampp startand it worked!

我停止了 MySQL sudo service mysql stop,然后启动了 xammp sudo /opt/lampp/lampp start,它起作用了!

回答by Soren Wagner

Though I'm using Mac OS 10.9, this solution may work for someone else as well, perhaps on Ubuntu.

虽然我使用的是 Mac OS 10.9,但这个解决方案也可能适用于其他人,也许在 Ubuntu 上。

In the XAMPP console, I only found that phpMyAdmin started working again after restarting everything including the Apache Web Server.

在 XAMPP 控制台中,我只发现 phpMyAdmin 在重新启动包括 Apache Web 服务器在内的所有内容后再次开始工作。

No problemo, now.

没问题,现在。

回答by Netorica

please check the mysql.ini file in your xampp mysql installation... its found on xampp/mysql/bin directory

请检查您的 xampp mysql 安装中的 mysql.ini 文件...它在 xampp/mysql/bin 目录中找到

check the line 43

检查第 43 行

> log_error="mysql_error.log"
> #bind-address="127.0.0.1"

uncomment the line 43 if its still commented

如果第 43 行仍有注释,则取消注释

回答by Mak

You can check it by connecting MySQL through the command prompt.

您可以通过命令提示符连接 MySQL 来检查它。

I think that your MySQL Database is blocked by firewall. Once stop all the services of antivirus software you have on your computer, then try to connect.

我认为您的 MySQL 数据库被防火墙阻止了。一旦停止计算机上的所有防病毒软件服务,然后尝试连接。

I faced this problem as well and rectified by blocking all firewalls..

我也遇到了这个问题并通过阻止所有防火墙来纠正..