MySQL 说:无法连接:无效的设置

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

MySQL Says: Cannot connect: invalid settings

mysqlphpmyadmin

提问by freerunner

We are using XAMPP in a shared environment in our local network. All the projects had the default mysql username and password. Recently I tried to change the user name and password of a project. And now I am not being able to access phpmyadmin. It just displays the following message:

我们在本地网络的共享环境中使用 XAMPP。所有项目都有默认的 mysql 用户名和密码。最近我尝试更改一个项目的用户名和密码。现在我无法访问 phpmyadmin。它只显示以下消息:

phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in your configuration and make sure that they correspond to the information given by the administrator of the MySQL server.

phpMyAdmin 尝试连接 MySQL 服务器,服务器拒绝连接。您应该检查配置中的主机、用户名和密码,并确保它们与 MySQL 服务器管理员提供的信息相对应。

Now no one is able to access the phpmyadmin. How can I solve this?

现在没有人能够访问phpmyadmin。我该如何解决这个问题?

回答by Rahul chak

Error:-Connection for controluser as defined in your configuration failed.

错误:-配置中定义的 controluser 连接失败。

solution:- because of in your ubuntu system two mysql server running so get confusion solve this problem stop mysql servert first

解决方案:- 因为在你的 ubuntu 系统中运行了两个 mysql 服务器,所以混淆解决这个问题首先停止 mysql servert

  1. open terminal
  2. type command:

    sudo /etc/init.d/mysql stop
    
  3. type command:

    sudo  /opt/lampp/lampp restart
    
  4. open localhost in browser
  1. 打开终端
  2. 键入命令:

    sudo /etc/init.d/mysql stop
    
  3. 键入命令:

    sudo  /opt/lampp/lampp restart
    
  4. 在浏览器中打开本地主机

回答by Avinash Babu

you can just solve this by editing the config.inc.phpfile from the phpmyadmin folder..

您可以通过编辑config.inc.phpphpmyadmin 文件夹中的文件来解决此问题。

This will work fine if you edit the update password with the same username..

如果您使用相同的用户名编辑更新密码,这将正常工作。

Find the line $cfg['Servers'][$i]['password'] =";

找到线 $cfg['Servers'][$i]['password'] =";

Just replace it with

只需将其替换为

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

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

Please have a look herefor more details

请看这里了解更多详情

回答by Yagnesh Panchal

Just add $cfg['Servers'][$i]['host']="127.0.0.1:3307";if you change port.

$cfg['Servers'][$i]['host']="127.0.0.1:3307";如果您更改端口,只需添加。

回答by Morgan Saville

In my case it was just because I had forgotten to turn on the 'MySQL' service on the XAMPP control panel. *facepalm*

就我而言,这只是因为我忘记打开 XAMPP 控制面板上的“MySQL”服务。*面掌*

回答by Jitesh Golecha

There is a bat file 'resetroot.bat' located in the xammp MySQL folder ie: 'C:\xampp\mysql'

xammp MySQL 文件夹中有一个 bat 文件“resetroot.bat”,即:“C:\xampp\mysql”

Run the bat file and it will reset the phpadmin passwords. Then start the MySQL service in xammp and try accessing phpmyadmin.

运行 bat 文件,它将重置 phpadmin 密码。然后在xammp中启动MySQL服务,尝试访问phpmyadmin。

Hope it helps.

希望能帮助到你。

回答by Veerabathiran R

I am also getting the same error, and finally found the answer with help of first reply of above post. But that is wrong because this error prone due to changed password so all of need to do this to get resolve it. previous it look like:

我也遇到了同样的错误,终于在上面帖子的第一个回复的帮助下找到了答案。但这是错误的,因为由于更改了密码而容易出现此错误,因此所有需要这样做才能解决它。以前它看起来像:

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

after I changed like:

在我改变之后:

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

The actual reason behind this while installing the XAMMP there is no password but after the that I added password for security. But it did't get updated in config.inc.phpso we need to update manually by following above steps.

这背后的实际原因是在安装 XAMMP 时没有密码,但之后我添加了密码以确保安全。但它没有得到更新,config.inc.php所以我们需要按照上述步骤手动更新。

回答by Dvel.Developer

First start the Apache server.

首先启动Apache服务器。

Then click config and open phpMyAdmin(config.inc.php)

然后点击配置并打开 phpMyAdmin(config.inc.php)

Initially you would be having this statement in your config.inc.php

最初你会在你的 config.inc.php

      ```$cfg['Servers'][$i]['host'] = '12.0.0.0';```

Change the IP address to 'localhost:'i.e., $cfg['Servers'][$i]['host'] = 'localhost:';

将 IP 地址更改为'localhost:'ie, $cfg['Servers'][$i]['host'] = 'localhost:';

I did this and the problem solved for me. Hope it helps :)

我这样做了,问题为我解决了。希望能帮助到你 :)

回答by sumon cse-sust

Step1: Go to xampp/phpMyAdmin/config.inc.php
Step2: Search this: $cfg['Servers'][$i]['host'] = '127.0.0.1';
Step3: Replace with $cfg['Servers'][$i]['host'] = '127.0.0.1:3307';

Here 3307 will be change  with your mysql port number, in my case it is 3307. Most of the times it will be 3306.

You can check your mysql port number from here : xampp/mysql/bin/my.ini

回答by udaya perera

find this line-:

找到这一行-:

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

replace it to this -:

将其替换为-:

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

it works for me.in my case I am using port 3306

它对我有用。就我而言,我使用的是 3306 端口

回答by Pankaj

For my case it seems the mysql server crashed, while it was it running state without any special thing happened. My web app was connected to the db server and was ideal for long time. I was trying to open the phpmyadmin and it started to give issues(same errors mentioned in the question) while connecting to db. After 5 mins I found my db crashed and not at all starting even after trying lot of things.

就我而言,mysql 服务器似乎崩溃了,而它处于运行状态,没有发生任何特殊的事情。我的网络应用程序连接到数据库服务器,很长时间以来都是理想的。我试图打开 phpmyadmin,它在连接到 db 时开始出现问题(问题中提到的相同错误)。5 分钟后,我发现我的数据库崩溃了,即使在尝试了很多事情之后也根本没有启动。