mysql 5.5 root密码忘记_MySql5.5忘记root密码怎么办

使用MysqL5.5,突然root密码忘记,怎么也登录不了,很急人,该怎么解决呢?下面通过本文给大家介绍MysqL5.5忘记root密码的解决办法,需要的朋友参考下吧

方法一:

操作系统:windows操作系统,xp或win7.

C:\Users\Administrator>cd C:\Program Files\MysqL\MysqL Server 5.5\bin

C:\Program Files\MysqL\MysqL Server 5.5\bin>net stop MysqL

MysqL 服务正在停止.

MysqL 服务已成功停止。

C:\Program Files\MysqL\MysqL Server 5.5\bin>MysqLd --skip-grant-tables

你会看到窗口光标在下一行的第一个位置闪烁,这说明已经启动了,不需要管。

新建一个命令行窗口同样进入到e:\MysqL5.5\bin目录,启动MysqL

C:\Program Files\MysqL\MysqL Server 5.5\bin>MysqL

Welcome to the MysqL monitor. Commands end with ; or \g.

Your MysqL connection id is 1

Server version: 5.5.36 MysqL Community Server (GPL)

Copyright (c) 2000,2014,Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MysqL> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| MysqL |

| performance_schema |

| test |

+--------------------+

4 rows in set (0.00 sec)

MysqL> use MysqL;

Database changed

MysqL> update user set password=PASSWORD('oracle') where user='root';

Query OK,2 rows affected (0.00 sec)

Rows matched: 2 Changed: 2 Warnings: 0

MysqL> flush privileges;

Query OK,0 rows affected (0.01 sec)

MysqL> quit

Bye

看看那任务管理器中是否有MysqLd.exe进程,如有,kill .

14839306071.jpg?2016011145552

C:\Program Files\MysqL\MysqL Server 5.5\bin>net start MysqL

MysqL 服务正在启动 .

MysqL 服务已经启动成功。

C:\Program Files\MysqL\MysqL Server 5.5\bin>MysqL -uroot -poracle

Welcome to the MysqL monitor. Commands end with ; or \g.

Your MysqL connection id is 1

Server version: 5.5.36 MysqL Community Server (GPL)

Copyright (c) 2000,Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MysqL>

方法二:

操作系统:windows操作系统,xp或win7.

1.dos命令行窗口 进入e:\MysqL5.5\bin,停止MysqL 服务

e:\MysqL5.5\bin>net stop MysqL

注意:看看那任务管理器中是否有MysqLd.exe进程,如有,kill them all.

2. 以不检查权限的方式启动MysqL

e:\MysqL5.5\bin>MysqLd.exe --skip-grant-tables

你会看到窗口光标在下一行的第一个位置闪烁,这说明已经启动了,不需要管。

3. 新建一个命令行窗口同样进入到e:\MysqL5.5\bin目录,启动MysqL

e:\MysqL5.5\bin>MysqL

4. 修改root密码

MysqL>use MysqL

MysqL>update user set password=PASSWORD('new_password') where user='root';

MysqL>flush privileges;

MysqL>quit

5. 看看那任务管理器中是否有MysqLd.exe进程,如有,kill them all.

6. 重启MysqL,就可以用你设置新密码登陆

e:\MysqL5.5\bin>net start MysqL

e:\MysqL5.5\bin>MysqL -u root -pnew_password

that's all .

总结

如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。

如您喜欢交流学习经验,点击链接加入交流1群:1065694478(已满)交流2群:163560250

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值