Mysql忘记密码的解决办法
星期六,2010 七 31 14:03:07
好久没有用数据库,难免把数据库的密码给忘了,那如果mysql 的数据库密码忘了该怎么办呢?这里介绍两种简单的方法可以重设密码!
Windows系统下如何重设密码
1.用系统管理员登陆系统。停止MySQL的服务。(可以通过“控制面板”-》“管理员工具”-》“服务”,然后在打开的窗口里找到 Mysql 服务,然后停止)
2.打开命令提示符,然后进入MySQL的安装目录,比如我的安装目录是c:\mysql, 进入C:\mysql\bin
3.跳过权限检查启动MySQL,输入下面的命令
c:\mysql\bin>mysqld --skip-grant-tables
这个时候命令提示符将会出现等待的状态。
4.重新打开一个命令提示符窗口,进入c:\mysql\bin目录,设置root的新密码mysql, 运行下面的命令:
use mysql;
update user SET password=password('new password') where user='root';
flush privileges;
5.重新启动Mysql服务,大功告成!
Unix&Linux系统下的解决办法:
1.用root或者运行mysqld的用户登录系统;
2.利用kill命令结束掉mysqld的进程。(可以打开命令行,然后运行“ps -ef | grep mysql” 来查看mysql 的进程ID, 然后利用“kill -9 mysql进程ID” 来杀掉此进程)
3.使用–skip-grant-tables参数启动MySQL Server
shell>mysqld --skip-grant-tables
4.为root@localhost设置新密码
use mysql;
update user SET password=password('new password') where user='root';
flush privileges;
5.重启MySQL Server,设置完成。
其实这两种方法就是针对不同的操作系统来进行的处理。
博主这个办法真的很有用。
[回复]
这确实是一种好的方法
呵呵,欢迎来我的博客
[回复]
不错。学习了。。
[回复]
我要让笑容成为自己的招牌动作
[回复]
你的博客好多广告啊!
[回复]
依洋 回复:
九月 22nd, 2010 at 10:13 下午
是啊! 可惜没有人点击!
[回复]
This site appears to recieve a great deal of visitors. How do you advertise it? It gives a nice individual twist on things. I guess having something authentic or substantial to give info on is the most important factor.
[回复]
Your RSS feed doesn’t work in my browser (google chrome) how can I fix it?
[回复]
依洋 回复:
十二月 14th, 2010 at 12:24 下午
I’m not sure. I can use it in Chrome, could you check the URL, It should be: http://feed.feedsky.com/ityizhan
[回复]
解决了我一大难题啊
[回复]
依洋 回复:
四月 10th, 2011 at 5:27 下午
哈哈,当时也解决了我的一大难题
[回复]