重置MySQL根密码不起作用 [英] Resetting MySQL root password not working

查看:160
本文介绍了重置MySQL根密码不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我花了很多时间阅读并尝试了数十种方法来重置根密码,但是我却一无所获.我发现(并尝试过)的最完整的说明集如下.顺便说一句,我正在Win7(32位)上运行MySQL 5.5.

I have spent many hours reading and trying dozens of variations of ways to reset the root password, but I am not getting anywhere. The most complete set of instructions I found (and tried) were the following. BTW, I am running MySQL 5.5 on Win7, 32 bit.

  1. 我创建了一个文件c:\ mysqlinit.txt,其中包含两行: UPDATE mysql.user SET Password = PASSWORD('myroot')WHERE User ='root'; 刷新权限;
  2. 从控制面板,管理工具,服务中停止了MySQL55服务
  3. 打开命令提示符窗口(以管理员身份运行)
  4. 导航到\ Program Files \ MySQL \ MySQL Server 5.5 \ bin \
  5. 执行命令 启动mysqld --init-file = C:\ mysqlinit.txt
  1. I created a file, c:\mysqlinit.txt, containing the two lines: UPDATE mysql.user SET Password=PASSWORD('myroot') WHERE User='root'; flush privileges;
  2. Stopped the MySQL55 Service from Control Panel, Admin Tools, Services
  3. Opened a Command prompt window (running as the admin)
  4. Navigated to \Program Files\MySQL\MySQL Server 5.5\bin\
  5. Executed the command start mysqld --init-file=C:\mysqlinit.txt

一切似乎都正常(没有错误).完成此过程后,我以为我可以使用root用户名和上面的密码登录,但是当我执行命令时

Everything seemed to work fine (no errors). At the completion of this procedure, I thought I could log on with the root user name and the above password, but when I executed the command

mysql -u根

我收到了错误消息,

错误1045(28000):用户'root'@'localhost'的访问被拒绝(使用密码:NO)

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

我可能做错了事,但找不到它,这让我发疯.

I am probably doing something wrong, but can't spot it and it is driving me nuts.

推荐答案

A可以通过以下步骤在Windows中重置密码:

A can reset password in windows with this steps:

1)首先停止运行Mysql服务(管理工具>服务)

1) Stop running Mysql service first (Administrative tools > Services )

2)"C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld.exe" -u root --skip-grant-tables

3)卸载mysql服务器

3) uninstall mysql server

4)安装mysql服务器并在安装中进行设置:

4) install mysql server and set in installation:

root current password - it's must be blank
new password - set your new passowrd
confirmation new password - set your new passowrd

还在那里我添加了新的管理员用户 konst

also there I added new admin user konst

这篇关于重置MySQL根密码不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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