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

Say*_*ial 34 mysql xampp phpmyadmin mysql-error-1045

我安装xampp,但当我尝试运行它时,我得到错误说,像这样:

错误

MySQL说:文档

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

配置中定义的controluser连接失败.phpMyAdmin尝试连接到MySQL服务器,服务器拒绝连接.您应该检查配置中的主机,用户名和密码,并确保它们对应于MySQL服务器管理员提供的信息.

我尝试在互联网上搜索解决方案,但我仍然无法解决我的问题.我已经在config.inc.php文件中检查我是否使用过密码.但我没有使用任何密码.当我尝试输入密码时,我仍然无法解决这个问题.

我希望有人能帮助我..谢谢

小智 71

phpMyAdmin中更改root用户的密码后,我遇到了这个问题.我对编程一无所知,但我通过以下方式解决了这个问题:

  1. 转到文件C:\wamp\apps\phpmyadmin3.2.0.1\config.inc.php(如果您不使用Wamp Server,我猜您会将"wamp"替换为您的服务器名称)

  2. 找到该行$cfg['Servers'][$i]['password']=''并将其更改为

    $cfg['Servers'][$i]['password']='NO'
    
    Run Code Online (Sandbox Code Playgroud)
  3. 尝试再次打开phpMyAdmin,希望该消息现在显示为"用户'root访问被拒'@'localhost'(使用密码:YES)

  4. 现在将上面一行中的密码更改为" yourpassword "(无论你之前设置的是什么)

希望这有助于某人.

  • 行`$ cfg ['Servers'] [$ i] ['password'] =''`甚至不存在于我的`config.inc.php`中.编辑:没关系,我打开了错误的config.inc.php,有多个. (2认同)
  • 只是给任何困惑的人。现在将上一行中的密码更改为 'yourpassword' 并不意味着将 ['password'] 更改为您的密码。这是我尝试过的,这意味着将 NO 更改为您的密码。 (2认同)

小智 15

转到文件C:\ wamp\apps\phpmyadmin3.2.0.1\config.inc.php

找到行$ cfg ['Servers'] [$ i] ['password'] =''并将其更改为

$cfg['Servers'][$i]['password']='root'
Run Code Online (Sandbox Code Playgroud)

希望这有助于某人.


小智 13

第一步:转到...... C:\ xampp\phpMyAdmin

第二步:打开config.inc.php文件

第三步:找到以下信息并更改密码.

/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'ENTER_YOUR_USER_NAME_HERE';
$cfg['Servers'][$i]['password'] = 'ENTER_YOUR_PASS_HERE';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Lang'] = '';
Run Code Online (Sandbox Code Playgroud)


Mar*_*son 9

这是获取1045 Access denied for user 'root'@'localhost' (using password: NO)phpMyAdmin 的解决方案.

首先,这是发生了什么:

当您使用没有密码的phpMyAdmin和没有root密码的mysql进行切换时会出现问题.您将mysql中的root更改为拥有root密码.你尽职尽责地更改phpMyAdmin的config.ini.php文件的$cfg['Servers'][$i]['password']=''行以包含你的密码并重启你可以找到的所有东西,但是phpMyAdmin仍然无法通过.

原因是您的浏览器仍然包含phpMyAdmin的cookie,而这些cookie反映出不需要密码来访问mysql.

解决方案:

清除与phpMyAdmin相关的cookie.它的浏览器具体,但在我的Firefox中,它在工具>页面信息> Cookies下.

您可能需要重新使用phpMyAdmin或使用signon.php脚本(在我的WAMP安装中的/ examples下).


Him*_*ari 5

试试这个:

  1. 在phpmyadmin目录中打开config.inc.php文件
  2. 查找第21行:$ cfg ['Servers'] [$ i] ['password'] =''
  3. 将其更改为:$ cfg ['Servers'] [$ i] ['password'] ='your_password';
  4. 重启XAMPP

参考


Dan*_*son 3

尝试这个:

1. xampp/htdocs/xampp/cds.php

change line 4 to: mysql_connect("localhost","root","enter password here");
change line 64 to: if(!mysql_connect("localhost","root","enter password here"))
Run Code Online (Sandbox Code Playgroud)

从这里