XAMPP phpMyadmin:更改密码后访问被拒绝

时间:2015-03-13 06:25:26

标签: php mysql phpmyadmin xampp

嗨,我知道这是一个古老的问题,但我已经尝试了许多答案和指南,但都是徒劳的。我之前在我的本地机器上使用的是没有密码的phpmyadmin,我使用命令提示符在Windows上使用以下命令更改了密码

  

mysqladmin.exe -u root password root

从那时起,我无法打开我的localhost / phpmyadmin,我收到了以下错误

  

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

我试过更改config.inc.php这个文件的当前状态如下

$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$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'] = '';

我尝试从localhost / security.php更改密码,并将密码更改为 123 。我还尝试通过打开 resetroot.bat 批处理文件来重置root密码。我认真地认为我搞砸了所以如果有人能在这里帮助我,我将感激不尽。 我在Windows 7上使用Xampp

编辑此外,我想告诉您,我已尝试提供新密码

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

还有

$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = '';

将用户更改为root

4 个答案:

答案 0 :(得分:9)

打开xampp / phpMyAdmin / config.inc并更改行

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

$cfg['Servers'][$i]['auth_type'] = 'cookie';
然后,PhpMyAdmin将显示一个登录屏幕,您可以在其中输入您的用户名和密码。

答案 1 :(得分:0)

您可以使用命令提示符将root密码定义为“root”,因此在配置中您必须使用相同的密码:

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

答案 2 :(得分:0)

有一个名为resetroot.bat的批处理文件位于xammp文件夹'C:\ xampp \ mysql'中运行此文件,它将删除phpadmin密码。然后,您需要做的就是在xammp中启动MySQL服务,然后单击管理按钮。

来源:How to get back Lost phpMyAdmin Password, XAMPP

答案 3 :(得分:0)

您必须在配置中更改密码 如果您忘记密码,请单击xampp根文件夹中mysql文件夹中的重置密码.bat文件

$cfg['server'][$i]['password'] = 'PassWordHere'

还要将更改还原为PMA配置,因为这可能导致事情制动