php XAMPP PhpMyAdmin 错误 1045,“用户 'root'@'localhost' 的访问被拒绝

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

XAMPP PhpMyAdmin Error 1045, "Access denied for user 'root'@'localhost'

phpmysqldrupalphpmyadmin

提问by Kripa

I see this question has been asked many times, but I don't find a solution for my problem. Tried all possible combinations in config.inc.php

我看到这个问题已经被问过很多次了,但我没有找到解决我的问题的方法。尝试了所有可能的组合config.inc.php

$cfg['Servers'][$i]['auth_type'] = 'http';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'root';
$cfg['Servers'][$i]['extension'] = 'mysql';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Lang'] = '';

/* Bind to the localhost ipv4 address and tcp */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';

/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = 'pmapass';

I installed XAMPP. In PhpMyAdmin I modified the password of root@localhost. I am able to login to PhpMyAdmin using the new password.

我安装了 XAMPP。在 PhpMyAdmin 中,我修改了root@localhost. 我可以使用新密码登录到 PhpMyAdmin。

But when I Add a new user Drupal as per drupal installation steps, I get this error:

但是,当我按照 drupal 安装步骤添加新用户 Drupal 时,出现此错误:

Error 1045, "Access denied for user 'root'@'localhost' (Password: YES)

But still the drupal user gets created but the drupal database in mysql doesnt get created.

但是仍然创建了 drupal 用户,但未创建 mysql 中的 drupal 数据库。

When I try to create drupal database separately I am able to do it.

当我尝试单独创建 drupal 数据库时,我能够做到。

Apart from this I tried MySQL.exe -u root -p. It works fine there, so I am not sure.

除此之外,我尝试了MySQL.exe -u root -p. 它在那里工作正常,所以我不确定。

回答by McAkinyi Adams

In the config.inc.php

在 config.inc.php

edit

编辑

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

to

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

Then restart.

然后重新启动。

And some magic will happen!!

一些魔法会发生!!

回答by Johnathan Barrett

Try changing

尝试改变

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

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

to

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

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

回答by raju gupta

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

to

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

Restart and you will be asked for the password the next access to the phpmyadmin page

重新启动,下次访问 phpmyadmin 页面时将要求您输入密码

回答by Chattar Singh Rathore

1045 - access denied for user 'root'@'localhost' (using password yes)

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

I have tried everything but this is the best solution

我已经尝试了一切,但这是最好的解决方案

Solution : Open xampp control panel config.inc.php

解决方案:打开xampp控制面板config.inc.php

$cfg['Servers'][$i]['auth_type'] = 'config'; to

$cfg['Servers'][$i]['auth_type'] = 'config'; 到

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

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

Work fine !!

工作正常!!

回答by Ahmad Ali

Add the following in:

添加以下内容:

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

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

Code:

代码:

/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'admin';
$cfg['Servers'][$i]['password'] = '';
/* Server parameters */
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = true;