重新获得WAMP上PHPMyAdmin丢失的MySQL密码的访问权限 [英] Regaining access to lost MySQL password for PHPMyAdmin on WAMP

查看:77
本文介绍了重新获得WAMP上PHPMyAdmin丢失的MySQL密码的访问权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在PHPMyAdmin中更改了我的'root'@'localhost'帐户的密码,并且类似(

I changed the password for my 'root'@'localhost' account in PHPMyAdmin and like (this person asking here) and locked myself out of PHPMyAdmin on my browser. I am using WAMP 2.5.

针对该问题提供的解决方案对我不起作用,因为不幸的是,我丢失了重新分配 root 的密码.

The solutions offered on that question don’t work for me because unfortunately I have lost the password that I reassigned root to.

某些解决方案要求人们通过命令行重置密码(包括以下内容)源代码),而我已经通过Windows命令行尝试了此操作,但没有成功,因为我现在没有任何权限:

Some solutions ask one to reset the password via command line (including this source), and I have tried that through the Windows command line without success because I now have no privileges:

mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('mynewpassword');

ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'mysql'

WAMP带有MySQL控制台,但是由于它提示我输入密码而不再使用,因此我无法使用它.

WAMP comes with a MySQL Console but I am unable to use it since it prompts me for a password which as I stated, no longer have.

此视频介绍了如何更改密码,并且同意上面给出了StackExchange的答案,但是很明显,我现在需要另一种方法来执行此操作,因为我不知道我会因为那个人的警告而失去访问权限.

This video explains how to change passwords, and it agrees with the answers in the StackExchange answer above, but evidently, I need another method to do this now since I did not know I would lose access as the guy warns.

对于任何建议,我将不胜感激,并对此表示歉意.我只是想使用堆栈进行Web开发,而通过WAMP配置对LAN站点的访问是一个冒险,因此,如果可能的话,我希望不需要重新安装所有内容.

I would appreciate any advice and apologise if this is a newbie type of thing to ask. I am just getting the hang of using a stack for web development, and configuring access to a LAN site through WAMP was quite an adventure, so if possible, I would prefer something that does not require reinstalling everything again.

编辑1 :继续尝试@RiggsFolly的解决方案.虽然我可以访问my.ini文件,进行毫无问题的更改,并且可以通过WAMP或其他方式毫无问题地重启MySQL,但行skip-grant-tables并未生效,给我留下了密码提示或无权执行任何操作. (我在这里写了一个新问题来解决此问题,因为我觉得这是一个不同的问题.)

Edit 1: Went ahead and tried @RiggsFolly ’s solution. While I can access the my.ini file, make changes without problem, and restart MySQL without issue through WAMP or otherwise, the line skip-grant-tables is not taking effect, leaving me with a password prompt or no access to do anything. (I wrote a new question here to troubleshoot this since I feel like this is a different issue.)

编辑2 :我尝试了@ t.niese在注释中提供的链接中的说明,并且当我将控制台设置为返回有关说明的反馈时,它报告了此情况,但未能更改任何东西:

Edit 2: I tried the instructions in the link provided by @t.niese in the comments and when I set the console to return feedback on the instructions, it reported this, and failed to change anything:

C:\wamp\bin\mysql\mysql5.6.17\bin>mysqld --skip-grant-tables --console
[Note] Plugin 'FEDERATED' is disabled.
[Note] InnoDB: Using atomics to ref count buffer pool pages
[Note] InnoDB: The InnoDB memory heap is disabled
[Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
[Note] InnoDB: Compressed tables use zlib 1.2.3
[Note] InnoDB: Not using CPU crc32 instructions
[Note] InnoDB: Initializing buffer pool, size = 128.0M
[Note] InnoDB: Completed initialization of buffer pool
[ERROR] InnoDB: .\ibdatai can't be opened in read-write mode
[ERROR] InnoDB: The system tablespace must be writabe!
[ERROR] Plugin 'InnoDB' init function returned error.
[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
[ERROR] Unknown/unsupported storage engine: InnoDB
[ERROR] Aborting
[Note] /* List of plugins shutting down */

推荐答案

这里是一种允许您非常简单地重置MYSQL'root'密码的方法.

Here is a method that will allow you to reset the MYSQL 'root' password quite simply.

停止mysql服务

wampmanager -> MySQL -> Service -> Stop Service

编辑my.ini文件

wampmanager -> MySQL -> my.ini

在ini文件中找到[wampmysqld](32位)或[wampmysqld64](64位)部分

Find the [wampmysqld](32bit) or [wampmysqld64](64bit) section in the ini file

在该部分标题之后直接添加此行

Add this line directly after that section heading

skip-grant-tables

重新启动mysql服务.

Restart the mysql service.

wampmanager -> MySQL -> Service -> Start/Resume Service

打开MySQL控制台

wampmanager -> MySQL -> MySQL Console

现在,我们将为root用户重置密码,当然,这可以用于重置任何用户的密码.

Now we are going to reset the password for the root user, of course this could be used to reset any users password.

mysql>命令提示符下输入以下2条命令,每条命令在行末都带有半冒号,并在每行之后按ENTER键以将命令发布给mysql.

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.

MYSQL 5.7之前版本

Pre MYSQL version 5.7

UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
FLUSH PRIVILEGES;

在MYSQL 5.7版之后,列名已更改

Post MYSQL version 5.7 the column name changed

UPDATE mysql.user SET authentication_string=PASSWORD('MyNewPass') WHERE User='root';
ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
FLUSH PRIVILEGES;

请注意,该更新可能会报告它已更新了多行,这是因为可能存在一个以上的用户帐户,这些用户帐户的"root"用户标识分别具有不同的域,即127.0.0.1,localhost和:: 1

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

Now enter 'quit' at the mysql command promt to exist mysql.

停止mysql服务

wampmanager -> MySQL -> Service -> Stop Service

编辑my.ini文件

wampmanager -> MySQL -> my.ini

在ini文件中找到[wampmysqld](32位)或[wampmysqld64](64位)部分

Find the [wampmysqld](32bit) or [wampmysqld64](64bit) section in the ini file

删除我们之前添加的skip-grant-tables参数.

Remove the skip-grant-tables parameter we added earlier.

请勿将此参数留在ini文件中,这是一个巨大的安全漏洞.

重新启动mysql服务.

Restart the mysql service.

wampmanager -> MySQL -> Service -> Start/Resume Service

您现在应该可以使用用户名'root'和您刚刚为该用户设置的新密码,使用phpmyadmin登录.

You should now be able to login with phpmyadmin using the userid 'root' and the new password you have just set for that user.

这篇关于重新获得WAMP上PHPMyAdmin丢失的MySQL密码的访问权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆