WAMP中的phpmyadmin错误#1045-需要重设密码 [英] phpmyadmin in WAMP error #1045 - Need to reset password
问题描述
我最近在PC上重新安装了WAMP,并从备份中复制了文件.我可以毫无问题地访问localhost
,并且我现有的站点正常运行.
I have recently reinstalled WAMP on my PC and copied over files from a back-up I had. I am able to access localhost
without any problem and my existing sites function fine.
问题是我似乎无法通过http://localhost/phpmyadmin/index.php
登录.我收到#1045无法登录MySQL服务器响应.
The problem is that I cannot seem to log-in via http://localhost/phpmyadmin/index.php
. I receive a #1045 Cannot log in to the MySQL server response.
做完一些阅读之后,我导致人们相信我可以编辑phpmyadmin的config.inc.php
文件来调整设置.设置完文件(如下所述)后,我得到一个无法连接:无效的设置.错误.
After doing some reading I have been lead to believe that I can edit phpmyadmin's config.inc.php
file to adjust the settings. After setting my files (as outlined below), I just get a Cannot connect: invalid settings. error.
<?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
*/
?>
有人可以指出我该怎么做才能解决问题?
我正在使用PHP 5.4.12和mySQL 5.6.12运行WAMP 2.我也曾尝试在WAMP中登录mySQL控制台,但无法通过密码请求...
I am running WAMP 2 using PHP 5.4.12 and mySQL 5.6.12. I've also attempted to log into the mySQL Console in WAMP but I cannot get past the password request...
推荐答案
如果该问题只是被忘记的密码,将允许您重置该密码.但是,如果您将不兼容的数据库与MySQL Server版本混合使用,则一旦重置密码,以后还会有其他问题.
If the problem is just a forgotten password this will allow you to reset it. However if you have mixed incompatible databases with MySQL Server versions there will be other problems later once you have reset the password.
停止mysql服务
wampmanager -> MySQL -> Service -> Stop Service
编辑my.ini文件
wampmanager -> MySQL -> my.ini
在ini文件中找到[wampmysqld]
部分.在[wampmysqld]
Find the [wampmysqld]
section in the ini file. Add this line directly after the section [wampmysqld]
skip-grant-tables
重新启动mysql服务.
wampmanager -> MySQL -> Service -> Start/Resume Service
Restart the mysql service.
wampmanager -> MySQL -> Service -> Start/Resume Service
打开MySQL控制台
wampmanager -> MySQL -> MySQL Console
Open the MySQL console
wampmanager -> MySQL -> MySQL Console
现在,我们将为root用户重置密码,当然,这可以用于重置任何用户的密码.
在mysql>
命令提示符处输入以下2条命令,每条命令在行尾加半冒号,并在每行后按ENTER键以将命令发布给mysql.
Now we are going to reset the password for the root user, of course this could be used to reset any users password.
Enter the following 2 commands at the mysql>
command prompt, each with a semi colon at the end of a line, and press ENTER after each line to issue the command to mysql.
UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
FLUSH PRIVILEGES;
对于5.7.0之后的MySQL版本
UPDATE mysql.user SET authentication_string = PASSWORD('MyNewPass'),
password_expired = 'N'
WHERE User = 'root';
FLUSH PRIVILEGES;
注意,该更新应报告它已更新了多行,这是因为实际上有3个用户帐户的用户名均为"root",每个用户帐户都具有不同的域
Note that the update should report that it has updated more than one row, that is because there are actually 3 user accounts with the userid of 'root' each with a different domain
即127.0.0.1,本地主机和:: 1 *
i.e. 127.0.0.1, localhost and ::1*
现在在mysql命令promt输入'quit'以存在mysql.
Now enter 'quit' at the mysql command promt to exist mysql.
停止mysql服务
wampmanager -> MySQL -> Service -> Stop Service
Stop the mysql service
wampmanager -> MySQL -> Service -> Stop Service
编辑my.ini文件
wampmanager -> MySQL -> my.ini
Edit the my.ini file
wampmanager -> MySQL -> my.ini
在ini文件中找到[wampmysqld]部分
删除我们之前添加的skip-grant-tables
参数.
Find the [wampmysqld] section in the ini file
Remove the skip-grant-tables
parameter we added earlier.
请勿将此参数留在ini文件中,这是一个巨大的安全漏洞.
重新启动mysql服务.
wampmanager -> MySQL -> Service -> Start/Resume Service
Restart the mysql service.
wampmanager -> MySQL -> Service -> Start/Resume Service
这篇关于WAMP中的phpmyadmin错误#1045-需要重设密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!