WAMP 中的 phpmyadmin 错误 #1045 - 需要重置密码
我最近在我的 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 ->服务 ->停止服务
编辑 my.ini 文件
Edit the my.ini file
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 ->服务 ->启动/恢复服务
打开 MySQL 控制台wampmanager ->MySQL ->MySQL 控制台
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;
MySQL 5.7.0 之后的版本
UPDATE mysql.user SET authentication_string = PASSWORD('MyNewPass'),
password_expired = 'N'
WHERE User = 'root';
FLUSH PRIVILEGES;
注意更新应该报告它已经更新了不止一行,那是因为实际上有3个用户帐户的用户ID为'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 命令提示符处输入 'quit' 以存在 mysql.
Now enter 'quit' at the mysql command promt to exist mysql.
停止mysql服务wampmanager ->MySQL ->服务 ->停止服务
编辑 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 ->服务 ->启动/恢复服务
相关文章