在WAMP中的phpmyadmin错误#1045 - 需要重置密码

She*_*ixt 4 php mysql wamp phpmyadmin wampserver

我最近在我的电脑上重新安装了WAMP,并从我备份的备份中复制了文件.我能够localhost毫无问题地访问,我现有的网站运行正常.

问题是我似乎无法通过登录http://localhost/phpmyadmin/index.php.我收到#1045无法登录MySQL服务器响应.

做了一些阅读后,我一直认为我可以编辑phpmyadmin的config.inc.php文件来调整设置.设置我的文件后(如下所述),我只是得到一个无法连接:无效设置.错误.

   <?php
/*
 * This is needed for cookie based authentication to encrypt password in
 * cookie
 */
$cfg['blowfish_secret'] = 'xampp'; /* YOU SHOULD CHANGE THIS FOR A MORE SECURE COOKIE AUTH! */

/*
 * Servers configuration
 */
$i = 0;

/*
 * First server
 */
$i++;

/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['AllowNoPasswordRoot'] = true;

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

/* Advanced phpMyAdmin features */
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
$cfg['Servers'][$i]['relation'] = 'pma_relation';
$cfg['Servers'][$i]['table_info'] = 'pma_table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma_column_info';
$cfg['Servers'][$i]['history'] = 'pma_history';
$cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';

/*
 * End of servers configuration
 */

?>
Run Code Online (Sandbox Code Playgroud)

有人可以指出我可以做些什么来解决这个问题吗?

我使用PHP 5.4.12和mySQL 5.6.12运行WAMP 2.我也试图在WAMP中登录mySQL控制台,但我无法通过密码请求...

Rig*_*lly 19

如果问题只是一个忘记的密码,这将允许您重置它.但是,如果您将不兼容的数据库与MySQL Server版本混合在一起,则在重置密码后会出现其他问题.

停止mysql服务

wampmanager -> MySQL -> Service -> Stop Service

编辑my.ini文件

wampmanager -> MySQL -> my.ini

找到[wampmysqld]ini文件中的部分.在该部分后面直接添加此行[wampmysqld]

skip-grant-tables
Run Code Online (Sandbox Code Playgroud)

重启mysql服务. wampmanager -> MySQL -> Service -> Start/Resume Service

打开MySQL控制台 wampmanager -> MySQL -> MySQL Console

现在我们将重置root用户的密码,当然这可以用来重置任何用户密码.在mysql>命令提示符处输入以下两个命令,每个命令在一行的末尾都有一个分号,并在每行后按ENTER键向mysql发出命令.

对于5.7.0之前的MySQL版本

UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
FLUSH PRIVILEGES;
Run Code Online (Sandbox Code Playgroud)

适用于5.7.0之后的MySQL版本

UPDATE mysql.user SET authentication_string = PASSWORD('MyNewPass'), 
                      password_expired = 'N' 
WHERE User = 'root';
FLUSH PRIVILEGES;
Run Code Online (Sandbox Code Playgroud)

请注意,更新应报告它已更新多行,这是因为实际上有3个用户帐户的用户标识为"root",每个用户帐户具有不同的域

即127.0.0.1,localhost和:: 1*

现在在mysql命令promt中输入'quit'以存在mysql.

停止mysql服务 wampmanager -> MySQL -> Service -> Stop Service

编辑my.ini文件 wampmanager -> MySQL -> my.ini

在ini文件中找到[wampmysqld]部分删除skip-grant-tables我们之前添加的参数.

请勿将此参数留在ini文件中作为HUGH安全漏洞.

重启mysql服务. wampmanager -> MySQL -> Service -> Start/Resume Service