热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

使用PHPMyAdmin拒绝用户“root”@“localhost”访问-Accessdeniedforuser'root'@'localhost'withPHPMyAdmin

WhenIsettherootpasswordinPHPMyAdmin,Igetthiserror:当我在PHPMyAdmin中设置root密码时,出现此错误:#1045

When I set the root password in PHPMyAdmin, I get this error:

当我在PHPMyAdmin中设置root密码时,出现此错误:

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

I can't open the PHPMyAdmin panel. What am I doing wrong?

我无法打开PHPMyAdmin面板。我究竟做错了什么?

2 个解决方案

#1


82  

Edit your phpmyadmin config.inc.php file and if you have Password, insert that in front of Password in following code:

编辑您的phpmyadmin config.inc.php文件,如果您有密码,请在以下代码中插入密码前面:

$cfg['Servers'][$i]['verbose'] = 'localhost';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = '**your-root-username**';
$cfg['Servers'][$i]['password'] = '**root-password**';
$cfg['Servers'][$i]['AllowNoPassword'] = true;

#2


3  

Here are few steps that must be followed carefully

以下是必须仔细遵循的几个步骤

  1. First of all make sure that the WAMP server is running if it is not running, start the server.
  2. 首先确保WAMP服务器在运行时运行,启动服务器。
  3. Enter the URL http://localhost/phpmyadmin/setup in address bar of your browser.
  4. 在浏览器的地址栏中输入URL http:// localhost / phpmyadmin / setup。
  5. Create a folder named config inside C:\wamp\apps\phpmyadmin, the folder inside apps may have different name like phpmyadmin3.2.0.1

    在C:\ wamp \ apps \ phpmyadmin中创建一个名为config的文件夹,应用程序内的文件夹可能有不同的名称,如phpmyadmin3.2.0.1

  6. Return to your browser in phpmyadmin setup tab, and click New server.New server

    在phpmyadmin设置选项卡中返回浏览器,然后单击“新建服务器”。

  7. Change the authentication type to ‘COOKIE’ and leave the username and password field empty but if you change the authentication type to ‘config’ enter the password for username root.

    将身份验证类型更改为“COOKIE”并将用户名和密码字段保留为空,但如果将身份验证类型更改为“config”,请输入username root的密码。

  8. Click save save

    点击保存

  9. Again click save in configuration file option.
  10. 再次单击配置文件选项中的保存。
  11. Now navigate to the config folder. Inside the folder there will be a file named config.inc.php. Copy the file and paste it out of the folder (if the file with same name is already there then override it) and finally delete the folder.
  12. 现在导航到config文件夹。在文件夹中,将有一个名为config.inc.php的文件。复制文件并将其粘贴到文件夹中(如果已经存在同名文件,则覆盖它),最后删除该文件夹。
  13. Now you are done. Try to connect the mysql server again and this time you won’t get any error. --credits Bibek Subedi
  14. 现在你完成了。尝试再次连接mysql服务器,这次你不会收到任何错误。 --credits Bibek Subedi

推荐阅读
author-avatar
四月草上飞2602920415
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有