MySQL phpMyAdmin - 无法连接 - 无效设置 - 自从我添加了 root 密码 - 被锁定

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

phpMyAdmin - can't connect - invalid setings - ever since I added a root password - locked out

mysqlphpmyadminroot

提问by OrangeRind

I run XAMPP, a few days back i had set up a password for the root password through phpmyadmin I am not able to access phpMyAdmin ever since that moment

我运行 XAMPP,几天前我通过 phpmyadmin 为 root 密码设置了密码,从那一刻起我就无法访问 phpMyAdmin

I followed help on this linkbut everything seems fine there (in config.inc.php). I even tried unistalling xampp fully, restarting windows and then reinstalling xampp, but still pointing to localhost/phpmyadmin I get the following error

我按照此链接的帮助进行操作,但那里的一切似乎都很好(在 config.inc.php 中)。我什至尝试完全卸载 xampp,重新启动 Windows 然后重新安装 xampp,但仍然指向 localhost/phpmyadmin 我收到以下错误

MySQL said: 
Cannot connect: invalid settings. 
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.

I Also tried to reset root password through mysqld.bat as given on mysql's website help but to no avail

我还尝试通过 mysqld.bat 重置 root 密码,如 mysql 网站帮助中给出的,但无济于事

Please Help! Here's a screenshot describing the situation: enter image description here

请帮忙!这是描述情况的屏幕截图: 在此处输入图片说明

回答by Saeros

Go inside your phpMyAdmin directory inside XAMPP installation folder. There will be a file called config.inc.php. Inside that file, find this line:

进入 XAMPP 安装文件夹内的 phpMyAdmin 目录。将有一个名为 config.inc.php 的文件。在该文件中,找到这一行:

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

you must make sure that this field has your mysql root password (the one that you set).

您必须确保此字段具有您的 mysql root 密码(您设置的密码)。

回答by agiles

PHPMYADMIN - Cannot connect: invalid settings.

PHPMYADMIN - 无法连接:无效设置。

I also faced similar issue but now I found a fix.

我也遇到了类似的问题,但现在我找到了解决方法。

For wamp server:

对于 wamp 服务器:

IN: C:\wamp\apps\phpmyadminVERSION\config.inc.php

在:C:\wamp\apps\phpmyadminVERSION\config.inc.php

$cfg['Servers'][$i]['AllowNoPasswordRoot'] = true; 

$cfg['Servers'][$i]['AllowNoPasswordRoot'] = false; 

For xampp server:

对于 xampp 服务器:

because of xampp server had the following settings.

因为 xampp 服务器有以下设置。

C:\xampp\phpMyAdmin\config.inc.php

C:\xampp\phpMyAdmin\config.inc.php

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

$cfg['Servers'][$i]['password'] = ''; // which is default setting in xampp server

$cfg['Servers'][$i]['password'] = 'your password';//type your password you have changed

回答by Trevor Allsopp

I had a similar problem not being able to access phpmyadmin on a testing server after changing the root password. I tried everything mentioned above, including advice from other forums, using all kinds of variations to the config files. THEN I remembered that Google Chrome has some issues working with a testing server. The reason is that Chrome has a security feature to prevent local hard drive access from a remote website - unfortunately this can cause issues in a testing environment because the server is a local hard drive. When I tried to log in to phpmyadmin with Internet Explorer it worked fine. I tried several tests of Chrome v IE9, and Chrome would not work under any configuration with the root password set. I also tested Firefox it also worked fine, the issue is only with Chrome. My advice: if you're on a testing server make sure your config file has the correct settings as described above, but if the problem continues and you're using Chrome try a different browser.

我有一个类似的问题,在更改 root 密码后无法访问测试服务器上的 phpmyadmin。我尝试了上面提到的所有内容,包括来自其他论坛的建议,使用配置文件的各种变体。然后我想起 Google Chrome 在使用测试服务器时遇到了一些问题。原因是 Chrome 有一个安全功能可以防止从远程网站访问本地硬盘驱动器 - 不幸的是,这可能会导致测试环境出现问题,因为服务器是本地硬盘驱动器。当我尝试使用 Internet Explorer 登录 phpmyadmin 时,它运行良好。我尝试了几次 Chrome v IE9 测试,Chrome 在设置了 root 密码的任何配置下都无法运行。我还测试了 Firefox,它也运行良好,问题仅在于 Chrome。我的建议:如果你

回答by Praz

Step 1: Go to

第 1 步:转到

http://localhost/security/xamppsecurity.php

Step 2: Set/Modify your password.

第 2 步:设置/修改您的密码。

Step 3: Open C:\xampp\phpMyAdmin\config.inc.php using a editor.

第 3 步:使用编辑器打开 C:\xampp\phpMyAdmin\config.inc.php。

Step 4: Check the following lines:

第 4 步:检查以下几行:

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

// your_password = the password that you have set in Step 2.

Step 5: Make sure the following line is set to TRUE: $cfg['Servers'][$i]['AllowNoPassword'] = true;

第 5 步:确保以下行设置为 TRUE: $cfg['Servers'][$i]['AllowNoPassword'] = true;

Step 6: Save the file, Restart MySQL from XAMPP Control Panel

第 6 步:保存文件,从 XAMPP 控制面板重启 MySQL

Step 7: Login into phpmyadmin with root & your password.

第 7 步:使用 root 和您的密码登录到 phpmyadmin。

Note: If again the same error comes, check the security page:

注意:如果再次出现同样的错误,请检查安全页面:

http://localhost/security/index.php

It will say: The MySQL admin user root has no longer no password SECURE
PhpMyAdmin password login is enabled. SECURE

它会说: MySQL 管理员用户 root 不再有密码 SECURE
PhpMyAdmin 密码登录已启用。安全的

Then Restart your system, the problem will be solved.

然后重启系统,问题就解决了。

回答by interesting eyy

Apply these changes in phpmyconfig/config.inc. Type in your username and password that you have set:

在 phpmyconfig/config.inc 中应用这些更改。输入您设置的用户名和密码:

$cfg['Servers'][$i]['user']                 = 'user';
$cfg['Servers'][$i]['password']             = 'password';
$cfg['Servers'][$i]['AllowNoPassword']      = false;

This works for me.

这对我有用。

回答by sylverfist

I faced the same problem after executing the following command in mysql

在mysql中执行以下命令后我遇到了同样的问题

UPDATE mysql.user SET Password=PASSWORD('blablabla') WHERE User='root'; FLUSH PRIVILEGES;

更新 mysql.user SET Password=PASSWORD('blablabla') WHERE User='root'; 同花顺特权;

what I did:

我做了什么:

open cmd

打开cmd

type

类型

cd c:\xampp\mysql\bin mysql.exe -u root --password

cd c:\xampp\mysql\bin mysql.exe -u root --password

after that mysql will prompt u

之后mysql会提示你

Enter password:blablabla

输入密码:blablabla

once youre in mysql, type

一旦你在mysql中,输入

UPDATE mysql.user SET Password=PASSWORD('') WHERE User='root'; FLUSH PRIVILEGES;

更新 mysql.user SET Password=PASSWORD('') WHERE User='root'; 同花顺特权;

Note:this time the password is left empty...

注意:这次密码留空...

make sure in your config.inc.php the following is set

确保在您的 config.inc.php 中设置了以下内容

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

$cfg['Servers'][$i]['AllowNoPasswordRoot'] = true; 

after that I can see my phpmyadmin...

之后我可以看到我的phpmyadmin ...

回答by Muhammad Riyaz

I had similar problem. Difference was that I was getting this error for only one database out all my databases. I removed the password , restarted mysql many times and still it dint work :(

我有类似的问题。不同之处在于我在所有数据库中只有一个数据库出现此错误。我删除了密码,多次重新启动 mysql,但它仍然有效:(

And when I cleared the cache of my browser it just started working !!!

当我清除浏览器的缓存时,它才开始工作!!!

This one really screwed my mind !

这个真的让我心碎!

回答by sedan

I had this same problem using the Windows XAMPP 1.7.4 -- after setting a password for mysql, I could no longer access phpMyAdmin. I changed the password in config.inc.php from ' ' to the new mysql password, and changed AllowNoPassword from true to false. I still couldn't log in.

我在使用 Windows XAMPP 1.7.4 时遇到了同样的问题——在为 mysql 设置密码后,我无法再访问 phpMyAdmin。我将 config.inc.php 中的密码从 ' ' 更改为新的 mysql 密码,并将 AllowNoPassword 从 true 更改为 false。我还是无法登录。

However, I saw that there is also a config.inc.php.safe file, and when I also edited the password settings in THAT file I was subsequently able to log in to phpMyAdmin.

但是,我看到还有一个 config.inc.php.safe 文件,当我还在那个文件中编辑密码设置时,我随后能够登录到 phpMyAdmin。

回答by Grant Li

I'm one of the noob too when I encountered something like this. So... I set the passwords using the command security page gave me: /opt/lampp/lampp security Then I used password xyz for all the passwords... Then when I go to site/, it ask for a basic authentication. But when I tried root//xyz, it does not allow me login. So, after some digging, it turns out the xyz password was set for a default user named 'lampp'. When I tried to login using lampp//xyz, it worked like a charm.

当我遇到这样的事情时,我也是菜鸟之一。所以......我使用命令安全页面设置密码给我:/opt/lampp/lampp security 然后我使用密码xyz作为所有密码......然后当我去站点/时,它要求进行基本身份验证。但是当我尝试 root//xyz 时,它不允许我登录。因此,经过一番挖掘,结果证明 xyz 密码是为名为“lampp”的默认用户设置的。当我尝试使用 lampp//xyz 登录时,它就像一个魅力。

The issue is that they made an assumption that everyone knows to use lampp//rootpw as their login o.O And... that is a basic auth for the directory! not pw for phpmyadmin or pw for mysql...

问题是他们假设每个人都知道使用 lampp//rootpw 作为他们的登录 oO 并且...这是目录的基本身份验证!不是 phpmyadmin 的密码或 mysql 的密码...

回答by Nisanth

1) Go to your Xampp Root folder

1) 转到您的 Xampp 根文件夹

For Ex : C:xampp/phpmyadmin/config.inc.php

例如:C:xampp/phpmyadmin/config.inc.php

2) In that find the following :

2)在那找到以下内容:

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

3) Here enter which password you set.

3) 在这里输入您设置的密码。

Ex : $cfg['servers'][$i]['password'] = '1234';

前任 : $cfg['servers'][$i]['password'] = '1234';

4) Then Save it and Restart your Xamp server.

4)然后保存并重新启动您的Xamp服务器。