<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>权记 &#187; mysql</title>
	<atom:link href="http://www.quanlei.com/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.quanlei.com</link>
	<description>一个关于我们生活点滴的网站，一个记录我们酸甜苦辣的日志。</description>
	<lastBuildDate>Sun, 06 Jun 2010 01:10:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>[10/12周主题] – MySQL性能分析命令：Explain 详解</title>
		<link>http://www.quanlei.com/2010/04/1012-week-subject-%e2%80%93-mysql-explain/</link>
		<comments>http://www.quanlei.com/2010/04/1012-week-subject-%e2%80%93-mysql-explain/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 09:50:39 +0000</pubDate>
		<dc:creator>小权</dc:creator>
				<category><![CDATA[周主题]]></category>
		<category><![CDATA[编程相关]]></category>
		<category><![CDATA[explain]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.quanlei.com/?p=1309</guid>
		<description><![CDATA[对explain的各个属性一知半解，今天详细的了解一下。 Explain命令在解决数据库性能上是第一推荐使用命令，大部分的性能问题可以通过此命令来简单的解决，Explain可以用来查看SQL语句的执行效果，可以帮助选择更好的索引和优化查询语句，写出更好的优化语句。 本周主题 &#8212; MySQL Explain 详解 Explain语法：explain select &#8230; from &#8230; [where ...] 例如：explain select * from news; 输出： +----+-------------+-------+-------+-------------------+---------+---------+-------+------+-------+ &#124; id &#124; select_type &#124; table &#124; type &#124; possible_keys &#124; key &#124; key_len &#124; ref &#124; rows &#124; Extra &#124; +----+-------------+-------+-------+-------------------+---------+---------+-------+------+-------+ 下面对各个属性进行了解： 1、id：这是SELECT的查询序列号 2、select_type：select_type就是select的类型，可以有以下几种： SIMPLE：简单SELECT(不使用UNION或子查询等) PRIMARY：最外面的SELECT UNION：UNION中的第二个或后面的SELECT语句 DEPENDENT UNION：UNION中的第二个或后面的SELECT语句，取决于外面的查询 UNION RESULT：UNION的结果。 SUBQUERY：子查询中的第一个SELECT DEPENDENT [...]]]></description>
			<content:encoded><![CDATA[<p>对explain的各个属性一知半解，今天详细的了解一下。 Explain命令在解决数据库性能上是第一推荐使用命令，大部分的性能问题可以通过此命令来简单的解决，Explain可以用来查看SQL语句的执行效果，可以帮助选择更好的索引和优化查询语句，写出更好的优化语句。</p>
<h2>本周主题 &#8212; MySQL Explain 详解</h2>
<p>Explain语法：explain select &#8230; from &#8230; [where ...]</p>
<p>例如：explain select * from news;</p>
<p>输出：<br />
<code><br />
+----+-------------+-------+-------+-------------------+---------+---------+-------+------+-------+<br />
| id | select_type | table | type  | possible_keys     | key     | key_len | ref   | rows | Extra |<br />
+----+-------------+-------+-------+-------------------+---------+---------+-------+------+-------+<br />
</code></p>
<p>下面对各个属性进行了解：</p>
<p>1、id：这是SELECT的查询序列号</p>
<p>2、select_type：select_type就是select的类型，可以有以下几种：</p>
<blockquote><p>SIMPLE：简单SELECT(不使用UNION或子查询等)</p>
<p>PRIMARY：最外面的SELECT</p>
<p>UNION：UNION中的第二个或后面的SELECT语句</p>
<p>DEPENDENT UNION：UNION中的第二个或后面的SELECT语句，取决于外面的查询</p>
<p>UNION RESULT：UNION的结果。</p>
<p>SUBQUERY：子查询中的第一个SELECT</p>
<p>DEPENDENT SUBQUERY：子查询中的第一个SELECT，取决于外面的查询</p>
<p>DERIVED：导出表的SELECT(FROM子句的子查询)</p></blockquote>
<p><span id="more-1309"></span><br />
3、table：显示这一行的数据是关于哪张表的</p>
<p>4、type：这列最重要，显示了连接使用了哪种类别,有无使用索引，是使用Explain命令分析性能瓶颈的关键项之一。</p>
<blockquote><p>结果值从好到坏依次是：</p>
<p>system &gt; const &gt; eq_ref &gt; ref &gt; fulltext &gt; ref_or_null &gt; index_merge &gt; unique_subquery &gt; index_subquery &gt; range &gt; index &gt; ALL</p>
<p>一般来说，得保证查询至少达到range级别，最好能达到ref，否则就可能会出现性能问题。</p></blockquote>
<p>5、possible_keys：列指出MySQL能使用哪个索引在该表中找到行</p>
<p>6、key：显示MySQL实际决定使用的键（索引）。如果没有选择索引，键是NULL</p>
<p>7、key_len：显示MySQL决定使用的键长度。如果键是NULL，则长度为NULL。使用的索引的长度。在不损失精确性的情况下，长度越短越好</p>
<p>8、ref：显示使用哪个列或常数与key一起从表中选择行。</p>
<p>9、rows：显示MySQL认为它执行查询时必须检查的行数。</p>
<p>10、Extra：包含MySQL解决查询的详细信息，也是关键参考项之一。</p>
<blockquote><p>Distinct<br />
一旦MYSQL找到了与行相联合匹配的行，就不再搜索了</p>
<p>Not exists<br />
MYSQL 优化了LEFT JOIN，一旦它找到了匹配LEFT JOIN标准的行，</p>
<p>就不再搜索了</p>
<p>Range  checked for each</p>
<p>Record（index map:#）<br />
没有找到理想的索引，因此对于从前面表中来的每一 个行组合，MYSQL检查使用哪个索引，并用它来从表中返回行。这是使用索引的最慢的连接之一</p>
<p>Using filesort<br />
看 到这个的时候，查询就需要优化了。MYSQL需要进行额外的步骤来发现如何对返回的行排序。它根据连接类型以及存储排序键值和匹配条件的全部行的行指针来 排序全部行</p>
<p>Using index<br />
列数据是从仅仅使用了索引中的信息而没有读取实际的行动的表返回的，这发生在对表 的全部的请求列都是同一个索引的部分的时候</p>
<p>Using temporary<br />
看到这个的时候，查询需要优化了。这 里，MYSQL需要创建一个临时表来存储结果，这通常发生在对不同的列集进行ORDER BY上，而不是GROUP BY上</p>
<p>Using  where<br />
使用了WHERE从句来限制哪些行将与下一张表匹配或者是返回给用户。如果不想返回表中的全部行，并且连接类型ALL或index， 这就会发生，或者是查询有问题</p></blockquote>
<p>其他一些Tip：</p>
<ol>
<li>当type 显示为 “index” 时，并且Extra显示为“Using Index”， 表明使用了覆盖索引。</li>
</ol>
<p>推荐阅读：<br />
Mysql Explain 详解(强烈推荐，带例子)：http://www.cnitblog.com/aliyiyi08/archive/2008/09/09/48878.html</p>
]]></content:encoded>
			<wfw:commentRss>http://www.quanlei.com/2010/04/1012-week-subject-%e2%80%93-mysql-explain/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>用mysqlsla来帮助分析慢查询日志</title>
		<link>http://www.quanlei.com/2010/03/mysqlsla-slow-query-log/</link>
		<comments>http://www.quanlei.com/2010/03/mysqlsla-slow-query-log/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 09:59:51 +0000</pubDate>
		<dc:creator>小权</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[编程相关]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[压力测试]]></category>
		<category><![CDATA[数据库]]></category>

		<guid isPermaLink="false">http://www.quanlei.com/?p=1294</guid>
		<description><![CDATA[项目做压力测试的时候难免会碰上数据库压力比预期的高，这个时候就要进行数据库和sql优化，其中一个很好的办法便是分析数据库的慢查询日志。 以前都是手动打开浏览，或者通过Mysql自带的mysqldumpslow来查看，今天分享另外一个工具：mysqlsla hackmysql.com推出的一款MySQL的日志分析工具 整体来说, 功能非常强大. 数据报表,非常有利于分析慢查询的原因, 包括执行频率, 数据量, 查询消耗等. 格式说明如下: 总查询次数 (queries total), 去重后的sql数量 (unique) 输出报表的内容排序(sorted by) 最重大的慢sql统计信息, 包括 平均执行时间, 等待锁时间, 结果行的总数, 扫描的行总数. Count, sql的执行次数及占总的slow log数量的百分比. Time, 执行时间, 包括总时间, 平均时间, 最小, 最大时间, 时间占到总慢sql时间的百分比. 95% of Time, 去除最快和最慢的sql, 覆盖率占95%的sql的执行时间. Lock Time, 等待锁的时间. 95% of Lock , 95%的慢sql等待锁时间. Rows sent, 结果行统计数量, 包括平均, 最小, 最大数量. Rows examined, 扫描的行数量. [...]]]></description>
			<content:encoded><![CDATA[<p>项目做压力测试的时候难免会碰上数据库压力比预期的高，这个时候就要进行数据库和sql优化，其中一个很好的办法便是分析数据库的慢查询日志。</p>
<p>以前都是手动打开浏览，或者通过Mysql自带的<strong>mysqldumpslow</strong>来查看，今天分享另外一个工具：<strong>mysqlsla</strong></p>
<p>hackmysql.com推出的一款MySQL的日志分析工具</p>
<p>整体来说, 功能非常强大. 数据报表,非常有利于分析慢查询的原因, 包括执行频率, 数据量, 查询消耗等.</p>
<p>格式说明如下:</p>
<blockquote><p>总查询次数 (queries total), 去重后的sql数量 (unique)</p>
<p>输出报表的内容排序(sorted by)</p>
<p>最重大的慢sql统计信息, 包括 平均执行时间, 等待锁时间, 结果行的总数, 扫描的行总数.</p>
<p>Count, sql的执行次数及占总的slow log数量的百分比.</p>
<p>Time, 执行时间, 包括总时间, 平均时间, 最小, 最大时间, 时间占到总慢sql时间的百分比.</p>
<p>95% of Time, 去除最快和最慢的sql, 覆盖率占95%的sql的执行时间.</p>
<p>Lock Time, 等待锁的时间.</p>
<p>95% of Lock , 95%的慢sql等待锁时间.</p>
<p>Rows sent, 结果行统计数量, 包括平均, 最小, 最大数量.</p>
<p>Rows examined, 扫描的行数量.</p>
<p>Database, 属于哪个数据库</p>
<p>Users, 哪个用户,IP, 占到所有用户执行的sql百分比</p>
<p>Query abstract, 抽象后的sql语句</p>
<p>Query sample, sql语句</p></blockquote>
<p>除了以上的输出, 官方还提供了很多定制化参数, 是一款不可多得的好工具.</p>
<p>安装和使用也非常简单<br />
安装：</p>
<blockquote><p>tar zxf http://hackmysql.com/scripts/mysqlsla-2.03.tar.gz<br />
cd mysqlsla-2.03<br />
perl Makefile.PL<br />
make<br />
make install</p></blockquote>
<p>简单使用：</p>
<blockquote><p>— Slow log: mysqlsla -lt slow slow.log</p>
<p>— General log: mysqlsla -lt general general.log</p>
<p>— Binary log: mysqlbinlog bin.log | mysqlsla -lt binary -</p></blockquote>
<p>mysqlsla会自动判断日志类型，缺省会打印出前十条结果，可以通过类似“&#8211;top 100”的参数来修改，如果觉得每次输入麻烦，还可以建立一个配置文件“~/.mysqlsla”，在文件里写上：top=100，这样就不用每次都手动输入参数了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.quanlei.com/2010/03/mysqlsla-slow-query-log/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>今天在做数据库备份时遇到的两个问题</title>
		<link>http://www.quanlei.com/2009/09/%e4%bb%8a%e5%a4%a9%e5%9c%a8%e5%81%9a%e6%95%b0%e6%8d%ae%e5%ba%93%e5%a4%87%e4%bb%bd%e6%97%b6%e9%81%87%e5%88%b0%e7%9a%84%e4%b8%a4%e4%b8%aa%e9%97%ae%e9%a2%98/</link>
		<comments>http://www.quanlei.com/2009/09/%e4%bb%8a%e5%a4%a9%e5%9c%a8%e5%81%9a%e6%95%b0%e6%8d%ae%e5%ba%93%e5%a4%87%e4%bb%bd%e6%97%b6%e9%81%87%e5%88%b0%e7%9a%84%e4%b8%a4%e4%b8%aa%e9%97%ae%e9%a2%98/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 04:01:02 +0000</pubDate>
		<dc:creator>小权</dc:creator>
				<category><![CDATA[技术]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[备份]]></category>
		<category><![CDATA[数据库]]></category>

		<guid isPermaLink="false">http://www.quanlei.com/2009/09/%e4%bb%8a%e5%a4%a9%e5%9c%a8%e5%81%9a%e6%95%b0%e6%8d%ae%e5%ba%93%e5%a4%87%e4%bb%bd%e6%97%b6%e9%81%87%e5%88%b0%e7%9a%84%e4%b8%a4%e4%b8%aa%e9%97%ae%e9%a2%98/</guid>
		<description><![CDATA[1. 使用备份脚本时, 出现 Error: bin/bash^M: bad interpreter: no such file or directory 原因: 不同操作系统换行符导致, Windows里面换行是CR+LF，Linux只有LF&#160;&#160;&#160; （CR = \r，LF = \n ….. in ascii code） 最简单的解决办法: Linux下, 运行 dos2unix filename 当然也有其他方法, 网上很多, 由于我们的服务器都是Linux, 这么用最简单了. 2. 将备份数据恢复后, 运行服务器, 出现: Exception Description: Could not deserialize object from byte array. 原因: 往数据库存的数据对象中使用了blob, 在做数据备份的脚本时,&#160; 没有考虑这点. 解决方法: 在mysqldump 语句的末尾添加 &#8211;hex-blob, 使用十六进制格式导出二进制字符串字段。如果有二进制数据就必须使用本选项。影响到的字段类型有 [...]]]></description>
			<content:encoded><![CDATA[<p><font color="#000000" size="2"><strong>1. 使用备份脚本时, 出现 Error: bin/bash^M: bad interpreter: no such file or directory</strong></font></p>
<p><font color="#000000" size="2">原因: 不同操作系统换行符导致, Windows里面换行是CR+LF，Linux只有LF&#160;&#160;&#160; （CR = \r，LF = \n ….. in ascii code）</font></p>
<p><font color="#000000" size="2">最简单的解决办法: Linux下, 运行 dos2unix filename</font></p>
<p><font color="#000000" size="2">当然也有其他方法, 网上很多, 由于我们的服务器都是Linux, 这么用最简单了.</font></p>
<p><font color="#000000" size="2"><strong>2. 将备份数据恢复后, 运行服务器, 出现: Exception Description: Could not deserialize object from byte array.</strong></font></p>
<p><font color="#000000" size="2">原因: 往数据库存的数据对象中使用了blob, 在做数据备份的脚本时,&#160; 没有考虑这点. </font></p>
<p><font color="#000000" size="2">解决方法: 在mysqldump 语句的末尾添加 &#8211;hex-blob, 使用十六进制格式导出二进制字符串字段。如果有二进制数据就必须使用本选项。影响到的字段类型有 BINARY、VARBINARY、BLOB。</font></p>
]]></content:encoded>
			<wfw:commentRss>http://www.quanlei.com/2009/09/%e4%bb%8a%e5%a4%a9%e5%9c%a8%e5%81%9a%e6%95%b0%e6%8d%ae%e5%ba%93%e5%a4%87%e4%bb%bd%e6%97%b6%e9%81%87%e5%88%b0%e7%9a%84%e4%b8%a4%e4%b8%aa%e9%97%ae%e9%a2%98/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>推荐一个Linux下的MySQL客户端 &#8211; MyJgui</title>
		<link>http://www.quanlei.com/2009/08/%e6%8e%a8%e8%8d%90%e4%b8%80%e4%b8%aalinux%e4%b8%8b%e7%9a%84mysql%e5%ae%a2%e6%88%b7%e7%ab%af-myjgui/</link>
		<comments>http://www.quanlei.com/2009/08/%e6%8e%a8%e8%8d%90%e4%b8%80%e4%b8%aalinux%e4%b8%8b%e7%9a%84mysql%e5%ae%a2%e6%88%b7%e7%ab%af-myjgui/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 08:22:12 +0000</pubDate>
		<dc:creator>小权</dc:creator>
				<category><![CDATA[Linux服务器相关]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.quanlei.com/2009/08/%e6%8e%a8%e8%8d%90%e4%b8%80%e4%b8%aalinux%e4%b8%8b%e7%9a%84mysql%e5%ae%a2%e6%88%b7%e7%ab%af-myjgui/</guid>
		<description><![CDATA[MyJgui 是一款用Java开发的MySQL数据库管理工具，最新版本0.7, 当然Windows平台也是可以用. 之所以推荐Linux下使用, 而非Windows, 是因为Windows下可选择的MySQl客户端太多了,而Linux则相对较少. 程序界面如下图所示:]]></description>
			<content:encoded><![CDATA[<p><a href="http://myjgui.com/"><span style="color: #000000; font-size: x-small;">MyJgui</span></a> <span style="color: #000000; font-size: x-small;">是一款用Java开发的MySQL数据库管理工具，最新版本0.7, 当然Windows平台也是可以用. 之所以推荐Linux下使用, 而非Windows, 是因为Windows下可选择的MySQl客户端太多了,而Linux则相对较少.</span></p>
<p><span style="color: #000000; font-size: x-small;">程序界面如下图所示:</span></p>
<p><a href="http://www.quanlei.com/wp-content/uploads/2009/08/MyJgui.png"><img class="alignleft" style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="MyJgui" src="http://www.quanlei.com/wp-content/uploads/2009/08/MyJgui_thumb.png" border="0" alt="MyJgui" width="618" height="480" align="right" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.quanlei.com/2009/08/%e6%8e%a8%e8%8d%90%e4%b8%80%e4%b8%aalinux%e4%b8%8b%e7%9a%84mysql%e5%ae%a2%e6%88%b7%e7%ab%af-myjgui/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux平台下忘记mysql的root密码解决办法</title>
		<link>http://www.quanlei.com/2009/03/linux%e5%b9%b3%e5%8f%b0%ef%bc%9a%e5%bf%98%e8%ae%b0mysql%e7%9a%84root%e5%af%86%e7%a0%81%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95/</link>
		<comments>http://www.quanlei.com/2009/03/linux%e5%b9%b3%e5%8f%b0%ef%bc%9a%e5%bf%98%e8%ae%b0mysql%e7%9a%84root%e5%af%86%e7%a0%81%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 13:32:40 +0000</pubDate>
		<dc:creator>小权</dc:creator>
				<category><![CDATA[Linux服务器相关]]></category>
		<category><![CDATA[技术]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[root]]></category>
		<category><![CDATA[密码]]></category>

		<guid isPermaLink="false">http://www.quanlei.com/?p=433</guid>
		<description><![CDATA[昨天晚上在Linux下更改了Mysql的root用户密码， 结果因为敲错了命令， 导致密码丢失， 无法进去， 无奈网上找忘记mysql密码的解决办法。 google， 百度上方法倒是不少， 大部分也类似， 下面的内容算是在Linux下比较完整有效的解决办法了， 贴出来共享下： 1．首先确认服务器出于安全的状态，也就是没有人能够任意地连接MySQL数据库。 因为在重新设置MySQL的root密码的期间，MySQL数据库完全出于没有密码保护的 状态下，其他的用户也可以任意地登录和修改MySQL的信息。可以采用将MySQL对 外的端口封闭，并且停止Apache以及所有的用户进程的方法实现服务器的准安全 状态。最安全的状态是到服务器的Console上面操作，并且拔掉网线。 2．修改MySQL的登录设置： # vi /etc/my.cnf 在[mysqld]的段中加上一句：skip-grant-tables 例如： [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock skip-grant-tables 保存并且退出vi。 3．重新启动mysqld # /etc/init.d/mysqld restart Stopping MySQL: [ OK ] Starting MySQL: [ OK ] 4．登录并修改MySQL的root密码 # /usr/bin/mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your [...]]]></description>
			<content:encoded><![CDATA[<p>昨天晚上在Linux下更改了Mysql的root用户密码， 结果因为敲错了命令， 导致密码丢失， 无法进去， 无奈网上找忘记mysql密码的解决办法。</p>
<p>google， 百度上方法倒是不少， 大部分也类似， 下面的内容算是在Linux下比较完整有效的解决办法了， 贴出来共享下：</p>
<div class="entry">
<p><span style="color: #000000;"><strong>1．首先确认服务器出于安全的状态，也就是没有人能够任意地连接MySQL数据库。 </strong><br />
因为在重新设置MySQL的root密码的期间，MySQL数据库完全出于没有密码保护的<br />
状态下，其他的用户也可以任意地登录和修改MySQL的信息。可以采用将MySQL对<br />
外的端口封闭，并且停止Apache以及所有的用户进程的方法实现服务器的准安全<br />
状态。最安全的状态是到服务器的Console上面操作，并且拔掉网线。 </span></p>
<p><span style="color: #000000;"><strong>2．修改MySQL的登录设置： </strong><br />
# vi /etc/my.cnf<br />
在[mysqld]的段中加上一句：skip-grant-tables<br />
例如：<br />
[mysqld]<br />
datadir=/var/lib/mysql<br />
socket=/var/lib/mysql/mysql.sock<br />
skip-grant-tables<br />
保存并且退出vi。 </span></p>
<p><span style="color: #000000;"><strong>3．重新启动mysqld </strong><br />
# /etc/init.d/mysqld restart<br />
Stopping MySQL: [ OK ]<br />
Starting MySQL: [ OK ] </span></p>
<p><span style="color: #000000;"><strong>4．登录并修改MySQL的root密码 </strong><br />
# /usr/bin/mysql<br />
Welcome to the MySQL monitor. Commands end with ; or \g.<br />
Your MySQL connection id is 3 to server version: 3.23.56 </span></p>
<p><span style="color: #000000;">Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer. </span></p>
<p><span style="color: #000000;">mysql&gt; USE mysql ;<br />
Reading table information for completion of table and column names<br />
You can turn off this feature to get a quicker startup with -A </span></p>
<p><span style="color: #000000;">Database changed<br />
mysql&gt; UPDATE user SET Password = password ( ‘new-password’ ) WHERE User = ‘root’ ;<br />
Query OK, 0 rows affected (0.00 sec)<br />
Rows matched: 2 Changed: 0 Warnings: 0 </span></p>
<p><span style="color: #000000;">mysql&gt; flush privileges ;<br />
Query OK, 0 rows affected (0.01 sec) </span></p>
<p><span style="color: #000000;">mysql&gt; quit<br />
Bye </span></p>
<p><span style="color: #000000;"><strong>5．将MySQL的登录设置修改回来 </strong><br />
# vi /etc/my.cnf<br />
将刚才在[mysqld]的段中加上的skip-grant-tables删除<br />
保存并且退出vi。 </span></p>
<p><span style="color: #000000;"><strong>6．重新启动mysqld </strong><br />
# /etc/init.d/mysqld restart<br />
Stopping MySQL: [ OK ]<br />
Starting MySQL: [ OK ] </span></p>
<p><span style="color: #000000;"><strong>7．恢复服务器的正常工作状态 </strong><br />
将步骤一中的操作逆向操作。恢复服务器的工作状态。 </span></div>
]]></content:encoded>
			<wfw:commentRss>http://www.quanlei.com/2009/03/linux%e5%b9%b3%e5%8f%b0%ef%bc%9a%e5%bf%98%e8%ae%b0mysql%e7%9a%84root%e5%af%86%e7%a0%81%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
