﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>IT博客-金鳞-随笔分类-Mysql</title><link>http://www.cnitblog.com/chenxin9821/category/8439.html</link><description>目标-&gt;软件测试架构师</description><language>zh-cn</language><lastBuildDate>Wed, 28 Sep 2011 08:19:05 GMT</lastBuildDate><pubDate>Wed, 28 Sep 2011 08:19:05 GMT</pubDate><ttl>60</ttl><item><title>忘记了mysql密码（windows）</title><link>http://www.cnitblog.com/chenxin9821/archive/2009/09/10/61343.html</link><dc:creator>金鳞</dc:creator><author>金鳞</author><pubDate>Thu, 10 Sep 2009 06:44:00 GMT</pubDate><guid>http://www.cnitblog.com/chenxin9821/archive/2009/09/10/61343.html</guid><wfw:comment>http://www.cnitblog.com/chenxin9821/comments/61343.html</wfw:comment><comments>http://www.cnitblog.com/chenxin9821/archive/2009/09/10/61343.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/chenxin9821/comments/commentRss/61343.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/chenxin9821/services/trackbacks/61343.html</trackback:ping><description><![CDATA[<p>前言：这事情谁遇到谁头疼！网上找到的方法，有些不可以，我在这里根据大家的方法结合我的情况，把解决方法方法写出来，希望你们别跟我一起头疼。<br><br><strong>Windows:</strong></p>
<p>1. 管理员登陆系统,停止mysql服务或者结束mysqld-nt进程<br>&nbsp;&nbsp;&nbsp; 在<span style="COLOR: #0000ff">cmd</span>下键入<span style="COLOR: #0000ff">net start</span>,之后察看列表中是否有<span style="COLOR: #0000ff">mysql</span>，如果有，就执行<span style="COLOR: #0000ff">net stop mysql</span>，这样就停止了mysql的服务。<br>2. 进入命令行,来到mysql的bin目录下，比如我的是C:\Program Files\MySQL\MySQL Server 5.0\bin。<br>&nbsp;&nbsp; <span style="COLOR: #0000ff">cd C:\Program Files\MySQL\MySQL Server 5.0\bin</span>,回车。<br>3. 运行 <font color=#0000ff>d:\mysql\bin\mysqld-nt --skip-grant-tables</font> 启动mysql,关闭权限的检查。这时，窗口动不了了(我至始至终都没有关闭这个窗口)，所以下一步的时候，你要重新开启一个cmd.<br>4. 运行 <font color=#0000ff>d:\mysql\bin\mysqladmin -u root flush-privileges password "newpassword"</font> 重设root密码<br>&nbsp;&nbsp;&nbsp;我的运行到这一步时，提示<br><span style="COLOR: #0000ff">&#8220;mysqladmin: connect to server at 'localhost' failed<font style="FONT-SIZE: 0px; COLOR: #fff">7 Y) j" C) D8 P: s/ `</font><br>&nbsp; error: 'Access denied for user 'root'@'localhost' (using password: NO)'</span><font style="FONT-SIZE: 0px; COLOR: #fff"><span style="COLOR: #0000ff">6 W# C'</span> </font>&#8221;<br>5. 接下来，咋办呢，我在<font color=#0000ff>C:\Program Files\MySQL\MySQL Server 5.0\bin<span style="COLOR: #000000">目录下，依次敲入<br></span>C:\Program Files\MySQL\MySQL Server 5.0\bin&gt;mysql -u root mysql<br>mysql&gt; UPDATE user SET password=PASSWORD("newpassword") WHERE user='name';<br>mysql&gt; FLUSH PRIVILEGES;<br>mysql&gt; QUIT<br><span style="COLOR: #000000">6.重新登陆（偶没有重启mysql服务，好懒哦）</span><br>C:\Program Files\MySQL\MySQL Server 5.0\bin&gt;mysql -u root -p<br>Enter password: **********<br>Welcome to the MySQL monitor.&nbsp; Commands end with ; or \g.<br>Your MySQL connection id is 3<br>Server version: 5.0.41-community-nt MySQL Community Edition (GP</font></p>
<p><font color=#0000ff>Type 'help;' or '\h' for help. Type '\c' to clear the buffer.<br>mysql&gt; show databases;<br>+--------------------+<br>| Database&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; |<br>+--------------------+<br>| information_schema |<br>| apple&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;|<br>| mysql&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br>| test&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;|<br>| testlink&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;|<br>| testlink162&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; |<br>+--------------------+<br></font>哇哇，got it!<br><br>主要引自：<a href="http://tech.techweb.com.cn/thread-210740-1-1.html">http://tech.techweb.com.cn/thread-210740-1-1.html</a><br><br></p>
<img src ="http://www.cnitblog.com/chenxin9821/aggbug/61343.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/chenxin9821/" target="_blank">金鳞</a> 2009-09-10 14:44 <a href="http://www.cnitblog.com/chenxin9821/archive/2009/09/10/61343.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>