查看: 1017|回复: 0

MySQL忘记密码怎么办

[复制链接]
发表于 2009-6-2 02:04:56 | 显示全部楼层 |阅读模式
在windows下:<br />打开命令行窗口,停止mysql服务:        Net stop mysql<br />启动mysql,一般到mysql的安装路径,找到 mysqld-nt.exe<br />执行:mysqld-nt --skip-grant-tables<br />另外打开一个命令行窗口,执行mysql<br />&gt;use mysql<br />&gt;update user set password=password(&quot;new_pass&quot;) where user=&quot;root&quot;;<br />&gt;flush privileges;<br />&gt;exit<br />用Ctrl+Alt+Del,找到mysqld-nt的进程杀掉它,在重新启动mysql-nt服务,就可以用新密码登录了<br /><br />在linux下:<br />如果 MySQL 正在运行,首先杀之: killall -TERM mysqld。 <br />启动 MySQL :bin/safe_mysqld --skip-grant-tables &amp; <br />就可以不需要密码就进入 MySQL 了。 <br />然后就是 <br />&gt;use mysql<br />&gt;update user set password=password(&quot;new_pass&quot;) where user=&quot;root&quot;;<br />&gt;flush privileges;<br />重新杀 MySQL ,用正常方法启动 MySQL 。<br /><br /><blockquote class="blockquote">From: http://www.husc.cn/read.php?tid=214  Powered by PHPWind.com</blockquote>
回复

使用道具 举报

本版积分规则

关注公众号

相关侵权、举报、投诉及建议等,请发 E-mail:admin@discuz.vip

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖
关注公众号
QQ客服返回顶部