<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[运维进行时]]></title> 
<link>https://blog.liuts.com/index.php</link> 
<description><![CDATA[互联网运维与架构]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[运维进行时]]></copyright>
<item>
<link>https://blog.liuts.com/post//</link>
<title><![CDATA[Mysql忘记密码后的解决办法(NT/Linux)]]></title> 
<author>root &lt;admin@yourname.com&gt;</author>
<category><![CDATA[MYSQL]]></category>
<pubDate>Sat, 22 Sep 2007 03:31:30 +0000</pubDate> 
<guid>https://blog.liuts.com/post//</guid> 
<description>
<![CDATA[ 
	[windows]<br/>1、停止mysql服务：打开命令行窗口CMD，Net stop mysql<br/>2、用另外一种方式启动Mysql：在命令行进入到mysql的安装路径下的bin目录下使用mysqld-nt.exe启动：mysqld-nt --skip-grant-tables<br/>&nbsp;&nbsp; 注意：此时CMD窗口不能关闭。<br/>3、进入Mysql：另外打开一个命入令行窗口，在bin目录下执行mysql，此时无需输入密码即可进入。<br/><textarea name="code" class="sql" rows="15" cols="100">
>use mysql
>update user set password=password("new_pass") where user="root";
>flush privileges;
>exit
</textarea><br/>&nbsp;&nbsp; 注意：1）如果对sql语句熟悉的话，update这句就不用解释了第一个User是表名、第二个User是表中的字段。第一个Password是表中的字段，第二个Password()是加密用的函数。new_pass是要更改的密码。<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2）flush privileges可以不用添加。但是如果添加了，一定要注意Host字段不能是Localhost。因为用了这个之后就不能用Localhost连接了。你可以把这个字段改成IP，或者通配符。<br/>>update user set host="192.168.0.1" where user="root"<br/>4、使用任务管理器，找到mysqld-nt的进程，结束进程！<br/>5、重新启动mysql服务，net start mysql 就可以用新密码登录了。<br/><br/>[linux]<br/>1、关闭Mysql： 如果 MySQL 正在运行，首先杀之 killall -TERM mysqld<br/>2、另外的方法启动 MySQL ：bin/safe_mysqld --skip-grant-tables &<br/>3、可以不需要密码就进入 MySQL 了。<br/>然后就是<br/><textarea name="code" class="sql" rows="15" cols="100">
>use mysql
>update user set password=password("new_pass") where user="root";
>flush privileges;
</textarea><br/>&nbsp;&nbsp; 注意点同上<br/>4、重新杀 MySQL ，用正常方法启动 MySQL 。 <br/>Tags - <a href="https://blog.liuts.com/tags/mysql/" rel="tag">mysql</a> , <a href="https://blog.liuts.com/tags/%25E5%25BF%2598%25E8%25AE%25B0%25E5%25AF%2586%25E7%25A0%2581/" rel="tag">忘记密码</a>
]]>
</description>
</item><item>
<link>https://blog.liuts.com/post//#blogcomment</link>
<title><![CDATA[[评论] Mysql忘记密码后的解决办法(NT/Linux)]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>https://blog.liuts.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>