<?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>记录与PHP的PK经历 &#187; mysql</title>
	<atom:link href="http://www.pkphp.com/category/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pkphp.com</link>
	<description>PK with php!</description>
	<lastBuildDate>Fri, 27 May 2011 02:07:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>mysql中的表显示“使用中”解决办法！</title>
		<link>http://www.pkphp.com/2010/12/11/mysql%e4%b8%ad%e7%9a%84%e8%a1%a8%e6%98%be%e7%a4%ba%e2%80%9c%e4%bd%bf%e7%94%a8%e4%b8%ad%e2%80%9d%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95%ef%bc%81/</link>
		<comments>http://www.pkphp.com/2010/12/11/mysql%e4%b8%ad%e7%9a%84%e8%a1%a8%e6%98%be%e7%a4%ba%e2%80%9c%e4%bd%bf%e7%94%a8%e4%b8%ad%e2%80%9d%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95%ef%bc%81/#comments</comments>
		<pubDate>Fri, 10 Dec 2010 16:57:40 +0000</pubDate>
		<dc:creator>askie</dc:creator>
				<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.pkphp.com/?p=1045</guid>
		<description><![CDATA[方法1： 检查表：CHECK TABLE xxtable 分析表：ANALYZE TABLE xxtable 修复表：REPAIR TABLE xxtable 方法2：如果方法1无法执行，请使用以下语句修复表索引 REPAIR TABLE xxtableUSE_FRM; Related items mysql_insert_id()错误 终于知道wordpress越来越慢的原因（一） mysql慢速(slow log)脚本分析 MySQL中设置自增字段 mysql优化脚本！ var escFun = window.encodeURIComponent ? window.encodeURIComponent : escape; var relatedlinks_js = document.createElement("script"); relatedlinks_js.setAttribute("charset", "utf-8"); relatedlinks_js.src = "http://relatedlinks.googlelabs.com/client/client.js?url=" + escFun(document.URL) + "&#038;referrer=" + escFun(document.referrer) + "&#038;relatedlinks_id=10098_5845376649736343543&#038;title=" + escFun(document.title); document.getElementsByTagName("head")[0].appendChild(relatedlinks_js);<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql-optimization-script%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2010%2F12%2F11%2Fmysql%25E4%25B8%25AD%25E7%259A%2584%25E8%25A1%25A8%25E6%2598%25BE%25E7%25A4%25BA%25E2%2580%259C%25E4%25BD%25BF%25E7%2594%25A8%25E4%25B8%25AD%25E2%2580%259D%25E8%25A7%25A3%25E5%2586%25B3%25E5%258A%259E%25E6%25B3%2595%25EF%25BC%2581%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql优化脚本！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F04%2Fmysql-slow-log%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2010%2F12%2F11%2Fmysql%25E4%25B8%25AD%25E7%259A%2584%25E8%25A1%25A8%25E6%2598%25BE%25E7%25A4%25BA%25E2%2580%259C%25E4%25BD%25BF%25E7%2594%25A8%25E4%25B8%25AD%25E2%2580%259D%25E8%25A7%25A3%25E5%2586%25B3%25E5%258A%259E%25E6%25B3%2595%25EF%25BC%2581%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql慢速(slow log)脚本分析</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql%25E4%25B8%25AD%25E8%25AE%25BE%25E7%25BD%25AE%25E8%2587%25AA%25E5%25A2%259E%25E5%25AD%2597%25E6%25AE%25B5%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2010%2F12%2F11%2Fmysql%25E4%25B8%25AD%25E7%259A%2584%25E8%25A1%25A8%25E6%2598%25BE%25E7%25A4%25BA%25E2%2580%259C%25E4%25BD%25BF%25E7%2594%25A8%25E4%25B8%25AD%25E2%2580%259D%25E8%25A7%25A3%25E5%2586%25B3%25E5%258A%259E%25E6%25B3%2595%25EF%25BC%2581%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">MySQL中设置自增字段</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F28%2Fmysql%25E9%259A%258F%25E6%259C%25BA%25E6%259F%25A5%25E8%25AF%25A2%25E8%25BE%2593%25E5%2587%25BA%25E6%2595%25B0%25E6%258D%25AE%25E8%25AF%25AD%25E5%258F%25A5%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2010%2F12%2F11%2Fmysql%25E4%25B8%25AD%25E7%259A%2584%25E8%25A1%25A8%25E6%2598%25BE%25E7%25A4%25BA%25E2%2580%259C%25E4%25BD%25BF%25E7%2594%25A8%25E4%25B8%25AD%25E2%2580%259D%25E8%25A7%25A3%25E5%2586%25B3%25E5%258A%259E%25E6%25B3%2595%25EF%25BC%2581%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql随机查询输出数据语句</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>方法1：</p>
<blockquote><p>检查表：CHECK TABLE xxtable<br />
分析表：ANALYZE TABLE xxtable<br />
修复表：REPAIR TABLE xxtable</p></blockquote>
<p>方法2：如果方法1无法执行，请使用以下语句修复表索引</p>
<blockquote><p>REPAIR TABLE xxtableUSE_FRM;</p></blockquote>
<h3 class="bsuite_related">Related items</h3>
<ul class="bsuite_related">
<li><a href='http://www.pkphp.com/2009/01/24/mysql_insert_id%e9%94%99%e8%af%af/'>mysql_insert_id()错误</a></li>
<li><a href='http://www.pkphp.com/2008/10/05/why-wordpress-so-slow/'>终于知道wordpress越来越慢的原因（一）</a></li>
<li><a href='http://www.pkphp.com/2008/10/04/mysql-slow-log/'>mysql慢速(slow log)脚本分析</a></li>
<li><a href='http://www.pkphp.com/2008/08/16/mysql%e4%b8%ad%e8%ae%be%e7%bd%ae%e8%87%aa%e5%a2%9e%e5%ad%97%e6%ae%b5/'>MySQL中设置自增字段</a></li>
<li><a href='http://www.pkphp.com/2008/08/16/mysql-optimization-script/'>mysql优化脚本！</a></li>
</ul>
<br /><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql-optimization-script%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2010%2F12%2F11%2Fmysql%25E4%25B8%25AD%25E7%259A%2584%25E8%25A1%25A8%25E6%2598%25BE%25E7%25A4%25BA%25E2%2580%259C%25E4%25BD%25BF%25E7%2594%25A8%25E4%25B8%25AD%25E2%2580%259D%25E8%25A7%25A3%25E5%2586%25B3%25E5%258A%259E%25E6%25B3%2595%25EF%25BC%2581%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql优化脚本！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F04%2Fmysql-slow-log%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2010%2F12%2F11%2Fmysql%25E4%25B8%25AD%25E7%259A%2584%25E8%25A1%25A8%25E6%2598%25BE%25E7%25A4%25BA%25E2%2580%259C%25E4%25BD%25BF%25E7%2594%25A8%25E4%25B8%25AD%25E2%2580%259D%25E8%25A7%25A3%25E5%2586%25B3%25E5%258A%259E%25E6%25B3%2595%25EF%25BC%2581%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql慢速(slow log)脚本分析</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql%25E4%25B8%25AD%25E8%25AE%25BE%25E7%25BD%25AE%25E8%2587%25AA%25E5%25A2%259E%25E5%25AD%2597%25E6%25AE%25B5%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2010%2F12%2F11%2Fmysql%25E4%25B8%25AD%25E7%259A%2584%25E8%25A1%25A8%25E6%2598%25BE%25E7%25A4%25BA%25E2%2580%259C%25E4%25BD%25BF%25E7%2594%25A8%25E4%25B8%25AD%25E2%2580%259D%25E8%25A7%25A3%25E5%2586%25B3%25E5%258A%259E%25E6%25B3%2595%25EF%25BC%2581%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">MySQL中设置自增字段</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F28%2Fmysql%25E9%259A%258F%25E6%259C%25BA%25E6%259F%25A5%25E8%25AF%25A2%25E8%25BE%2593%25E5%2587%25BA%25E6%2595%25B0%25E6%258D%25AE%25E8%25AF%25AD%25E5%258F%25A5%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2010%2F12%2F11%2Fmysql%25E4%25B8%25AD%25E7%259A%2584%25E8%25A1%25A8%25E6%2598%25BE%25E7%25A4%25BA%25E2%2580%259C%25E4%25BD%25BF%25E7%2594%25A8%25E4%25B8%25AD%25E2%2580%259D%25E8%25A7%25A3%25E5%2586%25B3%25E5%258A%259E%25E6%25B3%2595%25EF%25BC%2581%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql随机查询输出数据语句</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件" rel="nofollow">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.pkphp.com/2010/12/11/mysql%e4%b8%ad%e7%9a%84%e8%a1%a8%e6%98%be%e7%a4%ba%e2%80%9c%e4%bd%bf%e7%94%a8%e4%b8%ad%e2%80%9d%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95%ef%bc%81/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>mysql_insert_id()错误</title>
		<link>http://www.pkphp.com/2009/01/24/mysql_insert_id%e9%94%99%e8%af%af/</link>
		<comments>http://www.pkphp.com/2009/01/24/mysql_insert_id%e9%94%99%e8%af%af/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 15:22:05 +0000</pubDate>
		<dc:creator>askie</dc:creator>
				<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.pkphp.com/?p=853</guid>
		<description><![CDATA[mysql_insert_id &#8211;  取得上一步 INSERT 操作产生的 ID int mysql_insert_id ( [resource link_identifier]) mysql_insert_id() 返回给定的 link_identifier 中上一步 INSERT 查询中产生的 AUTO_INCREMENT 的 ID 号。如果没有指定 link_identifier，则使用上一个打开的连接。 如果上一查询没有产生 AUTO_INCREMENT 的值，则 mysql_insert_id() 返回 0。如果需要保存该值以后使用，要确保在产生了值的查询之后立即调用 mysql_insert_id()。 注: MySQL 中的 SQL 函数 LAST_INSERT_ID() 总是保存着最新产生的 AUTO_INCREMENT 值，并且不会在查询语句之间被重置。 警告 mysql_insert_id() 将 MySQL 内部的 C API 函数 mysql_insert_id() 的返回值转换成 long（PHP 中命名为 int）。如果 AUTO_INCREMENT 的列的类型是 BIGINT，则 mysql_insert_id() 返回的值将不正确。可以在 [...]<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql%25E4%25B8%25AD%25E8%25AE%25BE%25E7%25BD%25AE%25E8%2587%25AA%25E5%25A2%259E%25E5%25AD%2597%25E6%25AE%25B5%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F24%2Fmysql_insert_id%25E9%2594%2599%25E8%25AF%25AF%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">MySQL中设置自增字段</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F04%2Fmysql-slow-log%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F24%2Fmysql_insert_id%25E9%2594%2599%25E8%25AF%25AF%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql慢速(slow log)脚本分析</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F28%2Fmysql%25E9%259A%258F%25E6%259C%25BA%25E6%259F%25A5%25E8%25AF%25A2%25E8%25BE%2593%25E5%2587%25BA%25E6%2595%25B0%25E6%258D%25AE%25E8%25AF%25AD%25E5%258F%25A5%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F24%2Fmysql_insert_id%25E9%2594%2599%25E8%25AF%25AF%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql随机查询输出数据语句</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql-optimization-script%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F24%2Fmysql_insert_id%25E9%2594%2599%25E8%25AF%25AF%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql优化脚本！</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>mysql_insert_id &#8211;       取得上一步 INSERT 操作产生的 ID</p>
<p>int <strong class="methodname">mysql_insert_id</strong> ( [resource link_identifier])<br />
<strong class="function">mysql_insert_id()</strong> 返回给定的      <var class="parameter">link_identifier</var> 中上一步 INSERT 查询中产生的 AUTO_INCREMENT 的 ID 号。如果没有指定      <var class="parameter">link_identifier</var>，则使用上一个打开的连接。</p>
<p>如果上一查询没有产生      AUTO_INCREMENT 的值，则      <strong class="function">mysql_insert_id()</strong> 返回 0。如果需要保存该值以后使用，要确保在产生了值的查询之后立即调用      <strong class="function">mysql_insert_id()</strong>。</p>
<div class="note">
<blockquote class="note"><p><strong>注: </strong> MySQL 中的 SQL 函数       <var class="literal">LAST_INSERT_ID()</var> 总是保存着最新产生的       AUTO_INCREMENT 值，并且不会在查询语句之间被重置。</p></blockquote>
</div>
<p><strong>警告</strong></p>
<p>mysql_insert_id() 将 MySQL 内部的 C API 函数 mysql_insert_id() 的返回值转换成 long（PHP 中命名为 int）。如果 AUTO_INCREMENT 的列的类型是 BIGINT，则 mysql_insert_id() 返回的值将不正确。可以在 SQL 查询中用 MySQL 内部的 SQL 函数 LAST_INSERT_ID() 来替代。</p>
<p>具体使用如下语句：mysql_query(”SELECT LAST_INSERT_ID()”);<br />
<h3 class="bsuite_related">Related items</h3>
<ul class="bsuite_related">
<li><a href='http://www.pkphp.com/2010/12/11/mysql%e4%b8%ad%e7%9a%84%e8%a1%a8%e6%98%be%e7%a4%ba%e2%80%9c%e4%bd%bf%e7%94%a8%e4%b8%ad%e2%80%9d%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95%ef%bc%81/'>mysql中的表显示“使用中”解决办法！</a></li>
<li><a href='http://www.pkphp.com/2008/10/05/why-wordpress-so-slow/'>终于知道wordpress越来越慢的原因（一）</a></li>
<li><a href='http://www.pkphp.com/2008/10/04/mysql-slow-log/'>mysql慢速(slow log)脚本分析</a></li>
<li><a href='http://www.pkphp.com/2008/08/16/mysql%e4%b8%ad%e8%ae%be%e7%bd%ae%e8%87%aa%e5%a2%9e%e5%ad%97%e6%ae%b5/'>MySQL中设置自增字段</a></li>
<li><a href='http://www.pkphp.com/2008/08/16/mysql-optimization-script/'>mysql优化脚本！</a></li>
</ul>
<a href="http://www.pkphp.com/2009/01/24/mysql_insert_id%e9%94%99%e8%af%af/" title="http://www.pkphp.com/" style="font-size: 13px;">http://www.pkphp.com/</a>(1)<a href="http://www.pkphp.com/2009/01/24/mysql_insert_id%e9%94%99%e8%af%af/" title="mysql" style="font-size: 13px;">mysql</a>(2)<a href="http://www.pkphp.com/2009/01/24/mysql_insert_id%e9%94%99%e8%af%af/" title="mysql_insert_id auto_increment" style="font-size: 13px;">mysql_insert_id auto_increment</a>(1)<a href="http://www.pkphp.com/2009/01/24/mysql_insert_id%e9%94%99%e8%af%af/" title="mysql_insert_id 返回" style="font-size: 13px;">mysql_insert_id 返回</a>(3)<a href="http://www.pkphp.com/2009/01/24/mysql_insert_id%e9%94%99%e8%af%af/" title="mysql_insert_id返回为0" style="font-size: 13px;">mysql_insert_id返回为0</a>(1)<a href="http://www.pkphp.com/2009/01/24/mysql_insert_id%e9%94%99%e8%af%af/" title="zend framework mysql_insert_id()" style="font-size: 13px;">zend framework mysql_insert_id()</a>(1)<a href="http://www.pkphp.com/2009/01/24/mysql_insert_id%e9%94%99%e8%af%af/" title="mysql_insert_id 出错" style="font-size: 13px;">mysql_insert_id 出错</a>(4)<a href="http://www.pkphp.com/2009/01/24/mysql_insert_id%e9%94%99%e8%af%af/" title="mysql_insert_id()" style="font-size: 13px;">mysql_insert_id()</a>(3)<a href="http://www.pkphp.com/2009/01/24/mysql_insert_id%e9%94%99%e8%af%af/" title="mysql_insert_id 用法" style="font-size: 13px;">mysql_insert_id 用法</a>(20)<a href="http://www.pkphp.com/2009/01/24/mysql_insert_id%e9%94%99%e8%af%af/" title="mysql_insert_id 返回0" style="font-size: 13px;">mysql_insert_id 返回0</a>(2)<a href="http://www.pkphp.com/2009/01/24/mysql_insert_id%e9%94%99%e8%af%af/" title="mysql_insert_id" style="font-size: 13px;">mysql_insert_id</a>(19)<a href="http://www.pkphp.com/2009/01/24/mysql_insert_id%e9%94%99%e8%af%af/" title="mysql_insert_id zend framework" style="font-size: 13px;">mysql_insert_id zend framework</a>(2)<a href="http://www.pkphp.com/2009/01/24/mysql_insert_id%e9%94%99%e8%af%af/" title="php mysql_insert_id 总是返回0" style="font-size: 13px;">php mysql_insert_id 总是返回0</a>(2)<a href="http://www.pkphp.com/2009/01/24/mysql_insert_id%e9%94%99%e8%af%af/" title="mysq_insert_id 出错" style="font-size: 13px;">mysq_insert_id 出错</a>(1)<a href="http://www.pkphp.com/2009/01/24/mysql_insert_id%e9%94%99%e8%af%af/" title="levitra" style="font-size: 13px;">levitra</a>(1)<br /><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql%25E4%25B8%25AD%25E8%25AE%25BE%25E7%25BD%25AE%25E8%2587%25AA%25E5%25A2%259E%25E5%25AD%2597%25E6%25AE%25B5%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F24%2Fmysql_insert_id%25E9%2594%2599%25E8%25AF%25AF%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">MySQL中设置自增字段</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F04%2Fmysql-slow-log%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F24%2Fmysql_insert_id%25E9%2594%2599%25E8%25AF%25AF%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql慢速(slow log)脚本分析</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F28%2Fmysql%25E9%259A%258F%25E6%259C%25BA%25E6%259F%25A5%25E8%25AF%25A2%25E8%25BE%2593%25E5%2587%25BA%25E6%2595%25B0%25E6%258D%25AE%25E8%25AF%25AD%25E5%258F%25A5%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F24%2Fmysql_insert_id%25E9%2594%2599%25E8%25AF%25AF%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql随机查询输出数据语句</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql-optimization-script%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2009%2F01%2F24%2Fmysql_insert_id%25E9%2594%2599%25E8%25AF%25AF%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql优化脚本！</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件" rel="nofollow">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.pkphp.com/2009/01/24/mysql_insert_id%e9%94%99%e8%af%af/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>终于知道wordpress越来越慢的原因（一）</title>
		<link>http://www.pkphp.com/2008/10/05/why-wordpress-so-slow/</link>
		<comments>http://www.pkphp.com/2008/10/05/why-wordpress-so-slow/#comments</comments>
		<pubDate>Sun, 05 Oct 2008 12:49:46 +0000</pubDate>
		<dc:creator>askie</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysqldumpslow]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[慢速]]></category>

		<guid isPermaLink="false">http://www.pkphp.com/?p=731</guid>
		<description><![CDATA[最近服务器速度越来越慢，有时候服务器负载经常到达十几甚至看到过二十。博客打开的速度也慢了起来，今天花...<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F04%2Fmysql-slow-log%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F05%2Fwhy-wordpress-so-slow%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql慢速(slow log)脚本分析</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F08%2Fwordpress-auto-blogroll-design%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F05%2Fwhy-wordpress-so-slow%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">wordpress自助链接auto-blogroll插件设计细节！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F26%2Fwordpress-seo-v11%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F05%2Fwhy-wordpress-so-slow%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">wordpress中文seo插件升级到V1.1</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F11%2Fwordpress-plugin-auto-blogroll-v14-released%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F05%2Fwhy-wordpress-so-slow%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">wordpress自助插件auto blogroll V1.4 发布!</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>最近服务器速度越来越慢，有时候服务器负载经常到达十几甚至看到过二十。博客打开的速度也慢了起来，今天花时间研究看看到底什么网站、什么数据库查询引起的问题。</p>
<p>首先在服务器端对mysql设置了慢速sql日志输出，详细的设置方法见：<a href="http://www.pkphp.com/2008/10/04/mysql-slow-log/" target="_blank">mysql慢速(slow log)脚本分析</a></p>
<p>使用mysql自带的慢速日志查询工具对日志进行分析，按照最多查询记录排序，发现如下sql是查询出记录最多的，这条语句居然查出来9946条记录，俄地个乖乖，不慢才怪：</p>
<div style="border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #0000ff;">Count</span>: 18  <span style="color: #0000ff;">Time</span>=4294967294.94s (-1s)  Lock=0.00s (0s)  <span style="color: #0000ff;">Rows</span>=552.6 (9946), 2users@localhost</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #0000ff;">SELECT</span> post_title, DAYOFMONTH(post_date) <span style="color: #0000ff;">as</span> dom <span style="color: #0000ff;">FROM</span> wp_posts <span style="color: #0000ff;">WHERE</span> <span style="color: #0000ff;">YEAR</span>(post_date) = <span style="color: #006080;">'S'</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #0000ff;">AND</span> <span style="color: #0000ff;">MONTH</span>(post_date) = <span style="color: #006080;">'S'</span> <span style="color: #0000ff;">AND</span> post_date &lt; <span style="color: #006080;">'S'</span> <span style="color: #0000ff;">AND</span> post_type = <span style="color: #006080;">'S'</span> <span style="color: #0000ff;">AND</span> post_status = <span style="color: #006080;">'S'</span></pre>
</div>
</div>
<p>这个是mysqldumpslow出来的统计排列第一的结果。然后进入日志查找具体的sql语句发现：</p>
<div style="border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<div style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;">
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #0000ff;">use</span> abc;</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #0000ff;">SELECT</span> post_title, DAYOFMONTH(post_date) <span style="color: #0000ff;">as</span> dom <span style="color: #0000ff;">FROM</span> wp_posts</pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #0000ff;">WHERE</span> <span style="color: #0000ff;">YEAR</span>(post_date) = <span style="color: #006080;">'2008'</span> <span style="color: #0000ff;">AND</span> <span style="color: #0000ff;">MONTH</span>(post_date) = <span style="color: #006080;">'10'</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;"><span style="color: #0000ff;">AND</span> post_date &lt; <span style="color: #006080;">'2008-10-05 13:09:33'</span> <span style="color: #0000ff;">AND</span> post_type = <span style="color: #006080;">'post'</span></pre>
<pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;"><span style="color: #0000ff;">AND</span> post_status = <span style="color: #006080;">'publish'</span>;</pre>
</div>
</div>
<p>这样的类似语句很多，变化的都是时间，看了这个马上就明白这条语句不就是wordpress存档查询么！去看了一下wordpress，侧边栏输出了所有存档（archive）链接，我猜测就是因为存档链接的输出引起的这些sql查询。马上回到后台，关闭了所有的存档输出，再检测一段时间的mysql，发现这样的语句消失了！</p>
<p>终于找到了原因了，服务器负载有所降低，看来以后wordpress不能输出存档链接了！其实还有一个办法就是静态化日志链接也可以解决这个问题，我的做法是直接静态化了首页，即使首页输出了存档链接也不会引起查询。这样做也能降低一部分mysql查询。<br />
<h3 class="bsuite_related">Related items</h3>
<ul class="bsuite_related">
<li><a href='http://www.pkphp.com/2008/10/04/mysql-slow-log/'>mysql慢速(slow log)脚本分析</a></li>
<li><a href='http://www.pkphp.com/2008/08/16/mysql%e4%b8%ad%e8%ae%be%e7%bd%ae%e8%87%aa%e5%a2%9e%e5%ad%97%e6%ae%b5/'>MySQL中设置自增字段</a></li>
<li><a href='http://www.pkphp.com/2008/08/16/mysql-optimization-script/'>mysql优化脚本！</a></li>
<li><a href='http://www.pkphp.com/2008/07/28/mysql%e9%9a%8f%e6%9c%ba%e6%9f%a5%e8%af%a2%e8%be%93%e5%87%ba%e6%95%b0%e6%8d%ae%e8%af%ad%e5%8f%a5/'>mysql随机查询输出数据语句</a></li>
<li><a href='http://www.pkphp.com/2010/12/11/mysql%e4%b8%ad%e7%9a%84%e8%a1%a8%e6%98%be%e7%a4%ba%e2%80%9c%e4%bd%bf%e7%94%a8%e4%b8%ad%e2%80%9d%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95%ef%bc%81/'>mysql中的表显示“使用中”解决办法！</a></li>
</ul>
<a href="http://www.pkphp.com/2008/10/05/why-wordpress-so-slow/" title="http://www.pkphp.com/" style="font-size: 13px;">http://www.pkphp.com/</a>(2)<a href="http://www.pkphp.com/2008/10/05/why-wordpress-so-slow/" title="WordPress " style="font-size: 13px;">WordPress </a>(1)<a href="http://www.pkphp.com/2008/10/05/why-wordpress-so-slow/" title="wordpress 慢" style="font-size: 13px;">wordpress 慢</a>(63)<a href="http://www.pkphp.com/2008/10/05/why-wordpress-so-slow/" title="Wordpress 负载" style="font-size: 13px;">WordPress 负载</a>(18)<a href="http://www.pkphp.com/2008/10/05/why-wordpress-so-slow/" title="wordpress 发布日志慢" style="font-size: 13px;">wordpress 发布日志慢</a>(1)<a href="http://www.pkphp.com/2008/10/05/why-wordpress-so-slow/" title="ajax tree 越来越慢" style="font-size: 13px;">ajax tree 越来越慢</a>(1)<a href="http://www.pkphp.com/2008/10/05/why-wordpress-so-slow/" title="wordpress php 慢" style="font-size: 13px;">wordpress php 慢</a>(1)<a href="http://www.pkphp.com/2008/10/05/why-wordpress-so-slow/" title="wordpress 越来越慢" style="font-size: 13px;">wordpress 越来越慢</a>(3)<a href="http://www.pkphp.com/2008/10/05/why-wordpress-so-slow/" title="PHP 慢" style="font-size: 13px;">PHP 慢</a>(1)<a href="http://www.pkphp.com/2008/10/05/why-wordpress-so-slow/" title="wordpress慢" style="font-size: 13px;">wordpress慢</a>(4)<a href="http://www.pkphp.com/2008/10/05/why-wordpress-so-slow/" title="wordpress越來越慢" style="font-size: 13px;">wordpress越來越慢</a>(1)<a href="http://www.pkphp.com/2008/10/05/why-wordpress-so-slow/" title="wordpress打开慢" style="font-size: 13px;">wordpress打开慢</a>(4)<a href="http://www.pkphp.com/2008/10/05/why-wordpress-so-slow/" title="wordpress降低sql链接" style="font-size: 13px;">wordpress降低sql链接</a>(1)<a href="http://www.pkphp.com/2008/10/05/why-wordpress-so-slow/" title="wordpress 记录 数据库 慢" style="font-size: 13px;">wordpress 记录 数据库 慢</a>(1)<a href="http://www.pkphp.com/2008/10/05/why-wordpress-so-slow/" title="wordpress 打开 慢" style="font-size: 13px;">wordpress 打开 慢</a>(2)<br /><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F04%2Fmysql-slow-log%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F05%2Fwhy-wordpress-so-slow%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql慢速(slow log)脚本分析</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F08%2Fwordpress-auto-blogroll-design%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F05%2Fwhy-wordpress-so-slow%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">wordpress自助链接auto-blogroll插件设计细节！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F26%2Fwordpress-seo-v11%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F05%2Fwhy-wordpress-so-slow%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">wordpress中文seo插件升级到V1.1</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F11%2Fwordpress-plugin-auto-blogroll-v14-released%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F05%2Fwhy-wordpress-so-slow%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">wordpress自助插件auto blogroll V1.4 发布!</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件" rel="nofollow">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.pkphp.com/2008/10/05/why-wordpress-so-slow/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>mysql慢速(slow log)脚本分析</title>
		<link>http://www.pkphp.com/2008/10/04/mysql-slow-log/</link>
		<comments>http://www.pkphp.com/2008/10/04/mysql-slow-log/#comments</comments>
		<pubDate>Sat, 04 Oct 2008 12:34:11 +0000</pubDate>
		<dc:creator>askie</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[mysqldumpslow]]></category>
		<category><![CDATA[slow]]></category>

		<guid isPermaLink="false">http://www.pkphp.com/?p=724</guid>
		<description><![CDATA[mysql有一个功能就是可以log下来运行的比较慢的sql语句，默认是没有这个log的，为了开启这个功能，
要修改...<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F05%2Fwhy-wordpress-so-slow%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F04%2Fmysql-slow-log%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">终于知道wordpress越来越慢的原因（一）</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql-optimization-script%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F04%2Fmysql-slow-log%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql优化脚本！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql%25E4%25B8%25AD%25E8%25AE%25BE%25E7%25BD%25AE%25E8%2587%25AA%25E5%25A2%259E%25E5%25AD%2597%25E6%25AE%25B5%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F04%2Fmysql-slow-log%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">MySQL中设置自增字段</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F28%2Fmysql%25E9%259A%258F%25E6%259C%25BA%25E6%259F%25A5%25E8%25AF%25A2%25E8%25BE%2593%25E5%2587%25BA%25E6%2595%25B0%25E6%258D%25AE%25E8%25AF%25AD%25E5%258F%25A5%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F04%2Fmysql-slow-log%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql随机查询输出数据语句</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>mysql有一个功能就是可以log下来运行的比较慢的sql语句，默认是没有这个log的，为了开启这个功能，<br />
要修改my.cnf或者在mysql启动的时候加入一些参数。如果在my.cnf里面修改，需增加如下几行</p>
<p><code>long_query_time = 1<br />
log-slow-queries = /var/youpath/slow.log<br />
log-queries-not-using-indexes</code></p>
<p>long_query_time 是指执行超过多久的sql会被log下来，这里是1秒。<br />
log-slow-queries 设置把日志写在那里，可以为空，系统会给一个缺省的文件host_name-slow.log，<br />
log-queries-not-using-indexes 就是字面意思，log下来没有使用索引的query。</p>
<p>把上述参数打开，运行一段时间，就可以关掉了。</p>
<p>接下来就是分析了，这里的文件名字叫host-slow.log。<br />
先mysqldumpslow –help以下，e它主要用的是<br />
<code>-s ORDER what to sort by (t, at, l, al, r, ar etc), ‘at’ is default<br />
-t NUM just show the top n queries<br />
-g PATTERN grep: only consider stmts that include this string</code></p>
<p>-s，是order的顺序，说明写的不够详细，主要有<br />
c,t,l,r和ac,at,al,ar，分别是按照query次数，时间，lock的时间和返回的记录数来排序，前面加了a的时倒叙<br />
-t，是top n的意思，即为返回前面多少条的数据<br />
-g，后边可以写一个正则匹配模式，大小写不敏感的</p>
<p><code>mysqldumpslow -s c -t 20 host-slow.log<br />
mysqldumpslow -s r -t 20 host-slow.log</code></p>
<p>上述命令可以看出访问次数最多的20个sql语句和返回记录集最多的20个sql。<br />
<code>mysqldumpslow -t 10 -s t -g “left join” host-slow.log</code><br />
这个是按照时间返回前10条里面含有左连接的sql语句。</p>
<p>用了这个工具就可以查询出来那些sql语句是性能的瓶颈，进行优化，比如加索引，该应用的实现方式等。 </p>
<p><code>mysqldumpslow  -s c -t 10  /tmp/slow_query.log</code><br />
<h3 class="bsuite_related">Related items</h3>
<ul class="bsuite_related">
<li><a href='http://www.pkphp.com/2008/10/05/why-wordpress-so-slow/'>终于知道wordpress越来越慢的原因（一）</a></li>
<li><a href='http://www.pkphp.com/2008/08/16/mysql%e4%b8%ad%e8%ae%be%e7%bd%ae%e8%87%aa%e5%a2%9e%e5%ad%97%e6%ae%b5/'>MySQL中设置自增字段</a></li>
<li><a href='http://www.pkphp.com/2008/08/16/mysql-optimization-script/'>mysql优化脚本！</a></li>
<li><a href='http://www.pkphp.com/2008/07/28/mysql%e9%9a%8f%e6%9c%ba%e6%9f%a5%e8%af%a2%e8%be%93%e5%87%ba%e6%95%b0%e6%8d%ae%e8%af%ad%e5%8f%a5/'>mysql随机查询输出数据语句</a></li>
<li><a href='http://www.pkphp.com/2010/12/11/mysql%e4%b8%ad%e7%9a%84%e8%a1%a8%e6%98%be%e7%a4%ba%e2%80%9c%e4%bd%bf%e7%94%a8%e4%b8%ad%e2%80%9d%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95%ef%bc%81/'>mysql中的表显示“使用中”解决办法！</a></li>
</ul>
<a href="http://www.pkphp.com/2008/10/04/mysql-slow-log/" title="mysql log-queries-not-using-indexes" style="font-size: 13px;">mysql log-queries-not-using-indexes</a>(3)<a href="http://www.pkphp.com/2008/10/04/mysql-slow-log/" title="mysql log sql 语句" style="font-size: 13px;">mysql log sql 语句</a>(1)<a href="http://www.pkphp.com/2008/10/04/mysql-slow-log/" title="mysql 慢" style="font-size: 13px;">mysql 慢</a>(4)<a href="http://www.pkphp.com/2008/10/04/mysql-slow-log/" title="mysql log-slow-queries" style="font-size: 13px;">mysql log-slow-queries</a>(3)<a href="http://www.pkphp.com/2008/10/04/mysql-slow-log/" title="mysql log 为空" style="font-size: 13px;">mysql log 为空</a>(1)<a href="http://www.pkphp.com/2008/10/04/mysql-slow-log/" title="php mysql 慢" style="font-size: 13px;">php mysql 慢</a>(3)<a href="http://www.pkphp.com/2008/10/04/mysql-slow-log/" title="php mysql慢" style="font-size: 13px;">php mysql慢</a>(1)<a href="http://www.pkphp.com/2008/10/04/mysql-slow-log/" title="apache php slowly" style="font-size: 13px;">apache php slowly</a>(1)<a href="http://www.pkphp.com/2008/10/04/mysql-slow-log/" title="mysql" style="font-size: 13px;">mysql</a>(1)<a href="http://www.pkphp.com/2008/10/04/mysql-slow-log/" title="PHP 慢" style="font-size: 13px;">PHP 慢</a>(2)<a href="http://www.pkphp.com/2008/10/04/mysql-slow-log/" title="mysqldumpslow" style="font-size: 13px;">mysqldumpslow</a>(1)<a href="http://www.pkphp.com/2008/10/04/mysql-slow-log/" title="mysql slow log设置" style="font-size: 13px;">mysql slow log设置</a>(2)<a href="http://www.pkphp.com/2008/10/04/mysql-slow-log/" title="mysql slow query 脚本分析" style="font-size: 13px;">mysql slow query 脚本分析</a>(1)<a href="http://www.pkphp.com/2008/10/04/mysql-slow-log/" title="mysql slow log分析工具" style="font-size: 13px;">mysql slow log分析工具</a>(1)<a href="http://www.pkphp.com/2008/10/04/mysql-slow-log/" title="wordpress slow" style="font-size: 13px;">wordpress slow</a>(1)<br /><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F05%2Fwhy-wordpress-so-slow%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F04%2Fmysql-slow-log%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">终于知道wordpress越来越慢的原因（一）</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql-optimization-script%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F04%2Fmysql-slow-log%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql优化脚本！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql%25E4%25B8%25AD%25E8%25AE%25BE%25E7%25BD%25AE%25E8%2587%25AA%25E5%25A2%259E%25E5%25AD%2597%25E6%25AE%25B5%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F04%2Fmysql-slow-log%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">MySQL中设置自增字段</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F28%2Fmysql%25E9%259A%258F%25E6%259C%25BA%25E6%259F%25A5%25E8%25AF%25A2%25E8%25BE%2593%25E5%2587%25BA%25E6%2595%25B0%25E6%258D%25AE%25E8%25AF%25AD%25E5%258F%25A5%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F04%2Fmysql-slow-log%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql随机查询输出数据语句</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件" rel="nofollow">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.pkphp.com/2008/10/04/mysql-slow-log/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MySQL中设置自增字段</title>
		<link>http://www.pkphp.com/2008/08/16/mysql%e4%b8%ad%e8%ae%be%e7%bd%ae%e8%87%aa%e5%a2%9e%e5%ad%97%e6%ae%b5/</link>
		<comments>http://www.pkphp.com/2008/08/16/mysql%e4%b8%ad%e8%ae%be%e7%bd%ae%e8%87%aa%e5%a2%9e%e5%ad%97%e6%ae%b5/#comments</comments>
		<pubDate>Sat, 16 Aug 2008 05:56:16 +0000</pubDate>
		<dc:creator>askie</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[auto_increment]]></category>

		<guid isPermaLink="false">http://www.pkphp.com/?p=518</guid>
		<description><![CDATA[MySQL中设置自增字段

alter table album change ALBUM_ID ALBUM_ID bigint not null auto_increment;
alter table album auto_increment=1;

创建:
mysql>create table cc(id int auto_increment,name varchar(20),primary key(id));
修改:
mysql> alter table cc change id id int primary key auto_increment;
...<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql-optimization-script%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql%25E4%25B8%25AD%25E8%25AE%25BE%25E7%25BD%25AE%25E8%2587%25AA%25E5%25A2%259E%25E5%25AD%2597%25E6%25AE%25B5%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql优化脚本！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F04%2Fmysql-slow-log%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql%25E4%25B8%25AD%25E8%25AE%25BE%25E7%25BD%25AE%25E8%2587%25AA%25E5%25A2%259E%25E5%25AD%2597%25E6%25AE%25B5%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql慢速(slow log)脚本分析</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F28%2Fmysql%25E9%259A%258F%25E6%259C%25BA%25E6%259F%25A5%25E8%25AF%25A2%25E8%25BE%2593%25E5%2587%25BA%25E6%2595%25B0%25E6%258D%25AE%25E8%25AF%25AD%25E5%258F%25A5%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql%25E4%25B8%25AD%25E8%25AE%25BE%25E7%25BD%25AE%25E8%2587%25AA%25E5%25A2%259E%25E5%25AD%2597%25E6%25AE%25B5%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql随机查询输出数据语句</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F04%2F24%2Flinux%25E4%25B8%258B%25E6%2589%258B%25E5%258A%25A8%25E5%25AE%2589%25E8%25A3%2585pdo_mysql%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql%25E4%25B8%25AD%25E8%25AE%25BE%25E7%25BD%25AE%25E8%2587%25AA%25E5%25A2%259E%25E5%25AD%2597%25E6%25AE%25B5%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">linux下手动安装pdo_mysql</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>MySQL中设置自增字段</p>
<p>alter table album change ALBUM_ID ALBUM_ID bigint not null auto_increment;<br />
alter table album auto_increment=1;</p>
<p>创建:<br />
mysql>create table cc(id int auto_increment,name varchar(20),primary key(id));<br />
修改:<br />
mysql> alter table cc change id id int primary key auto_increment;</p>
<p>注:只有int类型且为primary key 才可以使用auto_increment.</p>
<p>如果用hibernate作为持久层,那么主键ID处用identity类型.</p>
<h3 class="bsuite_related">Related items</h3>
<ul class="bsuite_related">
<li><a href='http://www.pkphp.com/2008/10/05/why-wordpress-so-slow/'>终于知道wordpress越来越慢的原因（一）</a></li>
<li><a href='http://www.pkphp.com/2008/10/04/mysql-slow-log/'>mysql慢速(slow log)脚本分析</a></li>
<li><a href='http://www.pkphp.com/2008/08/16/mysql-optimization-script/'>mysql优化脚本！</a></li>
<li><a href='http://www.pkphp.com/2008/07/28/mysql%e9%9a%8f%e6%9c%ba%e6%9f%a5%e8%af%a2%e8%be%93%e5%87%ba%e6%95%b0%e6%8d%ae%e8%af%ad%e5%8f%a5/'>mysql随机查询输出数据语句</a></li>
<li><a href='http://www.pkphp.com/2010/12/11/mysql%e4%b8%ad%e7%9a%84%e8%a1%a8%e6%98%be%e7%a4%ba%e2%80%9c%e4%bd%bf%e7%94%a8%e4%b8%ad%e2%80%9d%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95%ef%bc%81/'>mysql中的表显示“使用中”解决办法！</a></li>
</ul>
<a href="http://www.pkphp.com/2008/08/16/mysql%e4%b8%ad%e8%ae%be%e7%bd%ae%e8%87%aa%e5%a2%9e%e5%ad%97%e6%ae%b5/" title="http://www.pkphp.com/" style="font-size: 13px;">http://www.pkphp.com/</a>(2)<a href="http://www.pkphp.com/2008/08/16/mysql%e4%b8%ad%e8%ae%be%e7%bd%ae%e8%87%aa%e5%a2%9e%e5%ad%97%e6%ae%b5/" title="mysql设置自增id" style="font-size: 13px;">mysql设置自增id</a>(1)<a href="http://www.pkphp.com/2008/08/16/mysql%e4%b8%ad%e8%ae%be%e7%bd%ae%e8%87%aa%e5%a2%9e%e5%ad%97%e6%ae%b5/" title="mysql自增类型" style="font-size: 13px;">mysql自增类型</a>(1)<a href="http://www.pkphp.com/2008/08/16/mysql%e4%b8%ad%e8%ae%be%e7%bd%ae%e8%87%aa%e5%a2%9e%e5%ad%97%e6%ae%b5/" title="MYSQL中关键字作为字段" style="font-size: 13px;">MYSQL中关键字作为字段</a>(1)<a href="http://www.pkphp.com/2008/08/16/mysql%e4%b8%ad%e8%ae%be%e7%bd%ae%e8%87%aa%e5%a2%9e%e5%ad%97%e6%ae%b5/" title="auto mysql id" style="font-size: 13px;">auto mysql id</a>(1)<a href="http://www.pkphp.com/2008/08/16/mysql%e4%b8%ad%e8%ae%be%e7%bd%ae%e8%87%aa%e5%a2%9e%e5%ad%97%e6%ae%b5/" title="无聊 site:pkphp.com" style="font-size: 13px;">无聊 site:pkphp.com</a>(3)<a href="http://www.pkphp.com/2008/08/16/mysql%e4%b8%ad%e8%ae%be%e7%bd%ae%e8%87%aa%e5%a2%9e%e5%ad%97%e6%ae%b5/" title="mysql alert auto =1" style="font-size: 13px;">mysql alert auto =1</a>(1)<a href="http://www.pkphp.com/2008/08/16/mysql%e4%b8%ad%e8%ae%be%e7%bd%ae%e8%87%aa%e5%a2%9e%e5%ad%97%e6%ae%b5/" title="mysql 自增字段" style="font-size: 13px;">mysql 自增字段</a>(14)<a href="http://www.pkphp.com/2008/08/16/mysql%e4%b8%ad%e8%ae%be%e7%bd%ae%e8%87%aa%e5%a2%9e%e5%ad%97%e6%ae%b5/" title="mysql设置自增" style="font-size: 13px;">mysql设置自增</a>(4)<a href="http://www.pkphp.com/2008/08/16/mysql%e4%b8%ad%e8%ae%be%e7%bd%ae%e8%87%aa%e5%a2%9e%e5%ad%97%e6%ae%b5/" title="mysql字段自增1" style="font-size: 13px;">mysql字段自增1</a>(1)<a href="http://www.pkphp.com/2008/08/16/mysql%e4%b8%ad%e8%ae%be%e7%bd%ae%e8%87%aa%e5%a2%9e%e5%ad%97%e6%ae%b5/" title="mysql 自增id" style="font-size: 13px;">mysql 自增id</a>(3)<a href="http://www.pkphp.com/2008/08/16/mysql%e4%b8%ad%e8%ae%be%e7%bd%ae%e8%87%aa%e5%a2%9e%e5%ad%97%e6%ae%b5/" title="mysql 字段 自增设置" style="font-size: 13px;">mysql 字段 自增设置</a>(1)<a href="http://www.pkphp.com/2008/08/16/mysql%e4%b8%ad%e8%ae%be%e7%bd%ae%e8%87%aa%e5%a2%9e%e5%ad%97%e6%ae%b5/" title="mysql id" style="font-size: 13px;">mysql id</a>(1)<a href="http://www.pkphp.com/2008/08/16/mysql%e4%b8%ad%e8%ae%be%e7%bd%ae%e8%87%aa%e5%a2%9e%e5%ad%97%e6%ae%b5/" title="mysql自增字段" style="font-size: 13px;">mysql自增字段</a>(3)<a href="http://www.pkphp.com/2008/08/16/mysql%e4%b8%ad%e8%ae%be%e7%bd%ae%e8%87%aa%e5%a2%9e%e5%ad%97%e6%ae%b5/" title="mysql设置id自增" style="font-size: 13px;">mysql设置id自增</a>(1)<br /><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql-optimization-script%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql%25E4%25B8%25AD%25E8%25AE%25BE%25E7%25BD%25AE%25E8%2587%25AA%25E5%25A2%259E%25E5%25AD%2597%25E6%25AE%25B5%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql优化脚本！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F04%2Fmysql-slow-log%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql%25E4%25B8%25AD%25E8%25AE%25BE%25E7%25BD%25AE%25E8%2587%25AA%25E5%25A2%259E%25E5%25AD%2597%25E6%25AE%25B5%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql慢速(slow log)脚本分析</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F28%2Fmysql%25E9%259A%258F%25E6%259C%25BA%25E6%259F%25A5%25E8%25AF%25A2%25E8%25BE%2593%25E5%2587%25BA%25E6%2595%25B0%25E6%258D%25AE%25E8%25AF%25AD%25E5%258F%25A5%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql%25E4%25B8%25AD%25E8%25AE%25BE%25E7%25BD%25AE%25E8%2587%25AA%25E5%25A2%259E%25E5%25AD%2597%25E6%25AE%25B5%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql随机查询输出数据语句</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F04%2F24%2Flinux%25E4%25B8%258B%25E6%2589%258B%25E5%258A%25A8%25E5%25AE%2589%25E8%25A3%2585pdo_mysql%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql%25E4%25B8%25AD%25E8%25AE%25BE%25E7%25BD%25AE%25E8%2587%25AA%25E5%25A2%259E%25E5%25AD%2597%25E6%25AE%25B5%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">linux下手动安装pdo_mysql</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件" rel="nofollow">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.pkphp.com/2008/08/16/mysql%e4%b8%ad%e8%ae%be%e7%bd%ae%e8%87%aa%e5%a2%9e%e5%ad%97%e6%ae%b5/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>mysql优化脚本！</title>
		<link>http://www.pkphp.com/2008/08/16/mysql-optimization-script/</link>
		<comments>http://www.pkphp.com/2008/08/16/mysql-optimization-script/#comments</comments>
		<pubDate>Sat, 16 Aug 2008 04:45:42 +0000</pubDate>
		<dc:creator>askie</dc:creator>
				<category><![CDATA[LAMP]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[优化]]></category>
		<category><![CDATA[脚本]]></category>

		<guid isPermaLink="false">http://www.pkphp.com/?p=515</guid>
		<description><![CDATA[[mysqld]
#port = 3306
#socket = /tmp/mysql.sock
#socket = /var/lib/mysql/mysql.sock
#skip-locking
key_buffer = 128M
max_allowed_packet = 1M
table_cache = 256
sort_buffer_size = 1M
net_buffer_length = 16K
myisam_sort_buffer_size = 1M
max_connections=120
#addnew config
wait_timeout =120...<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F04%2Fmysql-slow-log%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql-optimization-script%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql慢速(slow log)脚本分析</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F28%2Fmysql%25E9%259A%258F%25E6%259C%25BA%25E6%259F%25A5%25E8%25AF%25A2%25E8%25BE%2593%25E5%2587%25BA%25E6%2595%25B0%25E6%258D%25AE%25E8%25AF%25AD%25E5%258F%25A5%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql-optimization-script%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql随机查询输出数据语句</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql%25E4%25B8%25AD%25E8%25AE%25BE%25E7%25BD%25AE%25E8%2587%25AA%25E5%25A2%259E%25E5%25AD%2597%25E6%25AE%25B5%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql-optimization-script%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">MySQL中设置自增字段</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F04%2F24%2Flinux%25E4%25B8%258B%25E6%2589%258B%25E5%258A%25A8%25E5%25AE%2589%25E8%25A3%2585pdo_mysql%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql-optimization-script%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">linux下手动安装pdo_mysql</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p><code><br />
[mysqld]<br />
#port = 3306<br />
#socket = /tmp/mysql.sock<br />
#socket = /var/lib/mysql/mysql.sock<br />
#skip-locking<br />
key_buffer = 128M<br />
max_allowed_packet = 1M<br />
table_cache = 256<br />
sort_buffer_size = 1M<br />
net_buffer_length = 16K<br />
myisam_sort_buffer_size = 1M<br />
max_connections=120<br />
#addnew config<br />
wait_timeout =120<br />
back_log=100<br />
read_buffer_size = 1M<br />
thread_cache=32<br />
#skip-innodb<br />
#skip-bdb<br />
#skip-name-resolve<br />
join_buffer_size=512k<br />
query_cache_size = 64M<br />
interactive_timeout=120<br />
long_query_time=10<br />
log_slow_queries= /usr/local/mysql/slow_query.log<br />
query_cache_type= 1<br />
# Try number of CPU's*2 for thread_concurrency<br />
thread_concurrency = 4<br />
</code><br />
<h3 class="bsuite_related">Related items</h3>
<ul class="bsuite_related">
<li><a href='http://www.pkphp.com/2008/10/05/why-wordpress-so-slow/'>终于知道wordpress越来越慢的原因（一）</a></li>
<li><a href='http://www.pkphp.com/2008/10/04/mysql-slow-log/'>mysql慢速(slow log)脚本分析</a></li>
<li><a href='http://www.pkphp.com/2008/08/16/mysql%e4%b8%ad%e8%ae%be%e7%bd%ae%e8%87%aa%e5%a2%9e%e5%ad%97%e6%ae%b5/'>MySQL中设置自增字段</a></li>
<li><a href='http://www.pkphp.com/2008/08/11/ubuntu%e4%b8%8b%e5%ae%89%e8%a3%85-apachephpmysql%e6%96%87%e6%9c%ac%e6%9c%8d%e5%8a%a1%e5%99%a8%ef%bc%81/'>Ubuntu下安装 apache+php+mysql文本服务器！</a></li>
<li><a href='http://www.pkphp.com/2008/07/28/mysql%e9%9a%8f%e6%9c%ba%e6%9f%a5%e8%af%a2%e8%be%93%e5%87%ba%e6%95%b0%e6%8d%ae%e8%af%ad%e5%8f%a5/'>mysql随机查询输出数据语句</a></li>
</ul>
<a href="http://www.pkphp.com/2008/08/16/mysql-optimization-script/" title="mysql优化" style="font-size: 13px;">mysql优化</a>(7)<a href="http://www.pkphp.com/2008/08/16/mysql-optimization-script/" title="mysql 优化" style="font-size: 13px;">mysql 优化</a>(4)<a href="http://www.pkphp.com/2008/08/16/mysql-optimization-script/" title="php mysql 优化" style="font-size: 13px;">php mysql 优化</a>(14)<a href="http://www.pkphp.com/2008/08/16/mysql-optimization-script/" title="mysql" style="font-size: 13px;">mysql</a>(2)<a href="http://www.pkphp.com/2008/08/16/mysql-optimization-script/" title="mysql COMMENT" style="font-size: 13px;">mysql COMMENT</a>(3)<a href="http://www.pkphp.com/2008/08/16/mysql-optimization-script/" title="php mysql优化" style="font-size: 13px;">php mysql优化</a>(12)<a href="http://www.pkphp.com/2008/08/16/mysql-optimization-script/" title="mysql 优化脚本" style="font-size: 13px;">mysql 优化脚本</a>(3)<a href="http://www.pkphp.com/2008/08/16/mysql-optimization-script/" title="mysql优化脚本" style="font-size: 13px;">mysql优化脚本</a>(1)<a href="http://www.pkphp.com/2008/08/16/mysql-optimization-script/" title="php mysql 優化" style="font-size: 13px;">php mysql 優化</a>(1)<a href="http://www.pkphp.com/2008/08/16/mysql-optimization-script/" title="musql comment" style="font-size: 13px;">musql comment</a>(1)<a href="http://www.pkphp.com/2008/08/16/mysql-optimization-script/" title="mysql 优化 脚本" style="font-size: 13px;">mysql 优化 脚本</a>(1)<a href="http://www.pkphp.com/2008/08/16/mysql-optimization-script/" title="ubuntu mysql 优化" style="font-size: 13px;">ubuntu mysql 优化</a>(2)<a href="http://www.pkphp.com/2008/08/16/mysql-optimization-script/" title="mysql Slow_Query" style="font-size: 13px;">mysql Slow_Query</a>(2)<a href="http://www.pkphp.com/2008/08/16/mysql-optimization-script/" title="mysql脚本 comment" style="font-size: 13px;">mysql脚本 comment</a>(1)<a href="http://www.pkphp.com/2008/08/16/mysql-optimization-script/" title="vps mysql 优化" style="font-size: 13px;">vps mysql 优化</a>(2)<br /><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F04%2Fmysql-slow-log%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql-optimization-script%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql慢速(slow log)脚本分析</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F28%2Fmysql%25E9%259A%258F%25E6%259C%25BA%25E6%259F%25A5%25E8%25AF%25A2%25E8%25BE%2593%25E5%2587%25BA%25E6%2595%25B0%25E6%258D%25AE%25E8%25AF%25AD%25E5%258F%25A5%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql-optimization-script%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql随机查询输出数据语句</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql%25E4%25B8%25AD%25E8%25AE%25BE%25E7%25BD%25AE%25E8%2587%25AA%25E5%25A2%259E%25E5%25AD%2597%25E6%25AE%25B5%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql-optimization-script%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">MySQL中设置自增字段</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F04%2F24%2Flinux%25E4%25B8%258B%25E6%2589%258B%25E5%258A%25A8%25E5%25AE%2589%25E8%25A3%2585pdo_mysql%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql-optimization-script%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">linux下手动安装pdo_mysql</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件" rel="nofollow">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.pkphp.com/2008/08/16/mysql-optimization-script/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>mysql随机查询输出数据语句</title>
		<link>http://www.pkphp.com/2008/07/28/mysql%e9%9a%8f%e6%9c%ba%e6%9f%a5%e8%af%a2%e8%be%93%e5%87%ba%e6%95%b0%e6%8d%ae%e8%af%ad%e5%8f%a5/</link>
		<comments>http://www.pkphp.com/2008/07/28/mysql%e9%9a%8f%e6%9c%ba%e6%9f%a5%e8%af%a2%e8%be%93%e5%87%ba%e6%95%b0%e6%8d%ae%e8%af%ad%e5%8f%a5/#comments</comments>
		<pubDate>Mon, 28 Jul 2008 14:49:20 +0000</pubDate>
		<dc:creator>askie</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[数据]]></category>
		<category><![CDATA[查询]]></category>
		<category><![CDATA[随机]]></category>

		<guid isPermaLink="false">http://www.pkphp.com/?p=362</guid>
		<description><![CDATA[原来以为mysql没有随机输出数据的方法呢，google后还是搜索到了结果，代码如下：
select * from tablename order by rand() limit 10
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql-optimization-script%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F28%2Fmysql%25E9%259A%258F%25E6%259C%25BA%25E6%259F%25A5%25E8%25AF%25A2%25E8%25BE%2593%25E5%2587%25BA%25E6%2595%25B0%25E6%258D%25AE%25E8%25AF%25AD%25E5%258F%25A5%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql优化脚本！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F04%2Fmysql-slow-log%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F28%2Fmysql%25E9%259A%258F%25E6%259C%25BA%25E6%259F%25A5%25E8%25AF%25A2%25E8%25BE%2593%25E5%2587%25BA%25E6%2595%25B0%25E6%258D%25AE%25E8%25AF%25AD%25E5%258F%25A5%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql慢速(slow log)脚本分析</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql%25E4%25B8%25AD%25E8%25AE%25BE%25E7%25BD%25AE%25E8%2587%25AA%25E5%25A2%259E%25E5%25AD%2597%25E6%25AE%25B5%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F28%2Fmysql%25E9%259A%258F%25E6%259C%25BA%25E6%259F%25A5%25E8%25AF%25A2%25E8%25BE%2593%25E5%2587%25BA%25E6%2595%25B0%25E6%258D%25AE%25E8%25AF%25AD%25E5%258F%25A5%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">MySQL中设置自增字段</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F15%2F%25E4%25BD%25BF%25E7%2594%25A8sql_calc_found_rows%25E8%258E%25B7%25E5%258F%2596mysql%25E6%259F%25A5%25E8%25AF%25A2%25E8%25AE%25B0%25E5%25BD%2595%25E6%2580%25BB%25E6%2595%25B0%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F28%2Fmysql%25E9%259A%258F%25E6%259C%25BA%25E6%259F%25A5%25E8%25AF%25A2%25E8%25BE%2593%25E5%2587%25BA%25E6%2595%25B0%25E6%258D%25AE%25E8%25AF%25AD%25E5%258F%25A5%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">使用SQL_CALC_FOUND_ROWS获取mysql查询记录总数</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>原来以为mysql没有随机输出数据的方法呢，google后还是搜索到了结果，代码如下：<br />
<code>select * from tablename order by rand() limit 10</code></p>
<h3 class="bsuite_related">Related items</h3>
<ul class="bsuite_related">
<li><a href='http://www.pkphp.com/2008/10/05/why-wordpress-so-slow/'>终于知道wordpress越来越慢的原因（一）</a></li>
<li><a href='http://www.pkphp.com/2008/10/04/mysql-slow-log/'>mysql慢速(slow log)脚本分析</a></li>
<li><a href='http://www.pkphp.com/2008/08/16/mysql%e4%b8%ad%e8%ae%be%e7%bd%ae%e8%87%aa%e5%a2%9e%e5%ad%97%e6%ae%b5/'>MySQL中设置自增字段</a></li>
<li><a href='http://www.pkphp.com/2008/08/16/mysql-optimization-script/'>mysql优化脚本！</a></li>
<li><a href='http://www.pkphp.com/2010/12/11/mysql%e4%b8%ad%e7%9a%84%e8%a1%a8%e6%98%be%e7%a4%ba%e2%80%9c%e4%bd%bf%e7%94%a8%e4%b8%ad%e2%80%9d%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95%ef%bc%81/'>mysql中的表显示“使用中”解决办法！</a></li>
</ul>
<a href="http://www.pkphp.com/2008/07/28/mysql%e9%9a%8f%e6%9c%ba%e6%9f%a5%e8%af%a2%e8%be%93%e5%87%ba%e6%95%b0%e6%8d%ae%e8%af%ad%e5%8f%a5/" title="http://www.pkphp.com/" style="font-size: 13px;">http://www.pkphp.com/</a>(3)<a href="http://www.pkphp.com/2008/07/28/mysql%e9%9a%8f%e6%9c%ba%e6%9f%a5%e8%af%a2%e8%be%93%e5%87%ba%e6%95%b0%e6%8d%ae%e8%af%ad%e5%8f%a5/" title="mysql 随机函数" style="font-size: 13px;">mysql 随机函数</a>(4)<a href="http://www.pkphp.com/2008/07/28/mysql%e9%9a%8f%e6%9c%ba%e6%9f%a5%e8%af%a2%e8%be%93%e5%87%ba%e6%95%b0%e6%8d%ae%e8%af%ad%e5%8f%a5/" title="mysql 随机查找" style="font-size: 13px;">mysql 随机查找</a>(2)<a href="http://www.pkphp.com/2008/07/28/mysql%e9%9a%8f%e6%9c%ba%e6%9f%a5%e8%af%a2%e8%be%93%e5%87%ba%e6%95%b0%e6%8d%ae%e8%af%ad%e5%8f%a5/" title="mysql查询 输出语句" style="font-size: 13px;">mysql查询 输出语句</a>(1)<a href="http://www.pkphp.com/2008/07/28/mysql%e9%9a%8f%e6%9c%ba%e6%9f%a5%e8%af%a2%e8%be%93%e5%87%ba%e6%95%b0%e6%8d%ae%e8%af%ad%e5%8f%a5/" title="mysql 随机记录" style="font-size: 13px;">mysql 随机记录</a>(2)<a href="http://www.pkphp.com/2008/07/28/mysql%e9%9a%8f%e6%9c%ba%e6%9f%a5%e8%af%a2%e8%be%93%e5%87%ba%e6%95%b0%e6%8d%ae%e8%af%ad%e5%8f%a5/" title="php输出 mysql语句" style="font-size: 13px;">php输出 mysql语句</a>(1)<a href="http://www.pkphp.com/2008/07/28/mysql%e9%9a%8f%e6%9c%ba%e6%9f%a5%e8%af%a2%e8%be%93%e5%87%ba%e6%95%b0%e6%8d%ae%e8%af%ad%e5%8f%a5/" title="mysql" style="font-size: 13px;">mysql</a>(1)<a href="http://www.pkphp.com/2008/07/28/mysql%e9%9a%8f%e6%9c%ba%e6%9f%a5%e8%af%a2%e8%be%93%e5%87%ba%e6%95%b0%e6%8d%ae%e8%af%ad%e5%8f%a5/" title="mysql 随机查询" style="font-size: 13px;">mysql 随机查询</a>(12)<a href="http://www.pkphp.com/2008/07/28/mysql%e9%9a%8f%e6%9c%ba%e6%9f%a5%e8%af%a2%e8%be%93%e5%87%ba%e6%95%b0%e6%8d%ae%e8%af%ad%e5%8f%a5/" title="随机提取 mysql" style="font-size: 13px;">随机提取 mysql</a>(1)<a href="http://www.pkphp.com/2008/07/28/mysql%e9%9a%8f%e6%9c%ba%e6%9f%a5%e8%af%a2%e8%be%93%e5%87%ba%e6%95%b0%e6%8d%ae%e8%af%ad%e5%8f%a5/" title="php mysql 随机 字段 一条" style="font-size: 13px;">php mysql 随机 字段 一条</a>(1)<a href="http://www.pkphp.com/2008/07/28/mysql%e9%9a%8f%e6%9c%ba%e6%9f%a5%e8%af%a2%e8%be%93%e5%87%ba%e6%95%b0%e6%8d%ae%e8%af%ad%e5%8f%a5/" title="mysql 随机 条件 查询" style="font-size: 13px;">mysql 随机 条件 查询</a>(1)<a href="http://www.pkphp.com/2008/07/28/mysql%e9%9a%8f%e6%9c%ba%e6%9f%a5%e8%af%a2%e8%be%93%e5%87%ba%e6%95%b0%e6%8d%ae%e8%af%ad%e5%8f%a5/" title="php mysql 随机查找" style="font-size: 13px;">php mysql 随机查找</a>(1)<a href="http://www.pkphp.com/2008/07/28/mysql%e9%9a%8f%e6%9c%ba%e6%9f%a5%e8%af%a2%e8%be%93%e5%87%ba%e6%95%b0%e6%8d%ae%e8%af%ad%e5%8f%a5/" title="mysql 查询随机记录" style="font-size: 13px;">mysql 查询随机记录</a>(1)<a href="http://www.pkphp.com/2008/07/28/mysql%e9%9a%8f%e6%9c%ba%e6%9f%a5%e8%af%a2%e8%be%93%e5%87%ba%e6%95%b0%e6%8d%ae%e8%af%ad%e5%8f%a5/" title="zend framework mysql 随机" style="font-size: 13px;">zend framework mysql 随机</a>(1)<a href="http://www.pkphp.com/2008/07/28/mysql%e9%9a%8f%e6%9c%ba%e6%9f%a5%e8%af%a2%e8%be%93%e5%87%ba%e6%95%b0%e6%8d%ae%e8%af%ad%e5%8f%a5/" title="随机查询" style="font-size: 13px;">随机查询</a>(1)<br /><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql-optimization-script%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F28%2Fmysql%25E9%259A%258F%25E6%259C%25BA%25E6%259F%25A5%25E8%25AF%25A2%25E8%25BE%2593%25E5%2587%25BA%25E6%2595%25B0%25E6%258D%25AE%25E8%25AF%25AD%25E5%258F%25A5%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql优化脚本！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F04%2Fmysql-slow-log%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F28%2Fmysql%25E9%259A%258F%25E6%259C%25BA%25E6%259F%25A5%25E8%25AF%25A2%25E8%25BE%2593%25E5%2587%25BA%25E6%2595%25B0%25E6%258D%25AE%25E8%25AF%25AD%25E5%258F%25A5%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql慢速(slow log)脚本分析</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql%25E4%25B8%25AD%25E8%25AE%25BE%25E7%25BD%25AE%25E8%2587%25AA%25E5%25A2%259E%25E5%25AD%2597%25E6%25AE%25B5%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F28%2Fmysql%25E9%259A%258F%25E6%259C%25BA%25E6%259F%25A5%25E8%25AF%25A2%25E8%25BE%2593%25E5%2587%25BA%25E6%2595%25B0%25E6%258D%25AE%25E8%25AF%25AD%25E5%258F%25A5%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">MySQL中设置自增字段</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F15%2F%25E4%25BD%25BF%25E7%2594%25A8sql_calc_found_rows%25E8%258E%25B7%25E5%258F%2596mysql%25E6%259F%25A5%25E8%25AF%25A2%25E8%25AE%25B0%25E5%25BD%2595%25E6%2580%25BB%25E6%2595%25B0%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F28%2Fmysql%25E9%259A%258F%25E6%259C%25BA%25E6%259F%25A5%25E8%25AF%25A2%25E8%25BE%2593%25E5%2587%25BA%25E6%2595%25B0%25E6%258D%25AE%25E8%25AF%25AD%25E5%258F%25A5%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">使用SQL_CALC_FOUND_ROWS获取mysql查询记录总数</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件" rel="nofollow">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.pkphp.com/2008/07/28/mysql%e9%9a%8f%e6%9c%ba%e6%9f%a5%e8%af%a2%e8%be%93%e5%87%ba%e6%95%b0%e6%8d%ae%e8%af%ad%e5%8f%a5/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>MySQL修改root密码的多种方法</title>
		<link>http://www.pkphp.com/2008/04/21/mysql%e4%bf%ae%e6%94%b9root%e5%af%86%e7%a0%81%e7%9a%84%e5%a4%9a%e7%a7%8d%e6%96%b9%e6%b3%95/</link>
		<comments>http://www.pkphp.com/2008/04/21/mysql%e4%bf%ae%e6%94%b9root%e5%af%86%e7%a0%81%e7%9a%84%e5%a4%9a%e7%a7%8d%e6%96%b9%e6%b3%95/#comments</comments>
		<pubDate>Mon, 21 Apr 2008 14:00:55 +0000</pubDate>
		<dc:creator>askie</dc:creator>
				<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.pkphp.com/?p=34</guid>
		<description><![CDATA[方法1： 用SET PASSWORD命令 mysql -u root mysql&#62; SET PASSWORD FOR ‘root’@&#8217;localhost’ = PASSWORD(’newpass’); 方法2：用mysqladmin mysqladmin -u root password “newpass” 如果root已经设置过密码，采用如下方法 mysqladmin -u root password oldpass “newpass” 方法3： 用UPDATE直接编辑user表 mysql -u root mysql&#62; use mysql; mysql&#62; UPDATE user SET Password = PASSWORD(’newpass’) WHERE user = ‘root’; mysql&#62; FLUSH PRIVILEGES; 在丢失root密码的时候，可以这样 mysqld_safe –skip-grant-tables&#38; mysql -u root mysql [...]<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql-optimization-script%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F04%2F21%2Fmysql%25E4%25BF%25AE%25E6%2594%25B9root%25E5%25AF%2586%25E7%25A0%2581%25E7%259A%2584%25E5%25A4%259A%25E7%25A7%258D%25E6%2596%25B9%25E6%25B3%2595%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql优化脚本！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F04%2Fmysql-slow-log%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F04%2F21%2Fmysql%25E4%25BF%25AE%25E6%2594%25B9root%25E5%25AF%2586%25E7%25A0%2581%25E7%259A%2584%25E5%25A4%259A%25E7%25A7%258D%25E6%2596%25B9%25E6%25B3%2595%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql慢速(slow log)脚本分析</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F28%2Fmysql%25E9%259A%258F%25E6%259C%25BA%25E6%259F%25A5%25E8%25AF%25A2%25E8%25BE%2593%25E5%2587%25BA%25E6%2595%25B0%25E6%258D%25AE%25E8%25AF%25AD%25E5%258F%25A5%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F04%2F21%2Fmysql%25E4%25BF%25AE%25E6%2594%25B9root%25E5%25AF%2586%25E7%25A0%2581%25E7%259A%2584%25E5%25A4%259A%25E7%25A7%258D%25E6%2596%25B9%25E6%25B3%2595%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql随机查询输出数据语句</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql%25E4%25B8%25AD%25E8%25AE%25BE%25E7%25BD%25AE%25E8%2587%25AA%25E5%25A2%259E%25E5%25AD%2597%25E6%25AE%25B5%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F04%2F21%2Fmysql%25E4%25BF%25AE%25E6%2594%25B9root%25E5%25AF%2586%25E7%25A0%2581%25E7%259A%2584%25E5%25A4%259A%25E7%25A7%258D%25E6%2596%25B9%25E6%25B3%2595%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">MySQL中设置自增字段</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>方法1： 用SET PASSWORD命令<br />
mysql -u root<br />
mysql&gt; SET PASSWORD FOR ‘root’@&#8217;localhost’ = PASSWORD(’newpass’);</p>
<p>方法2：用mysqladmin<br />
mysqladmin -u root password “newpass”<br />
如果root已经设置过密码，采用如下方法<br />
mysqladmin -u root password oldpass “newpass”</p>
<p>方法3： 用UPDATE直接编辑user表<br />
mysql -u root<br />
mysql&gt; use mysql;<br />
mysql&gt; UPDATE user SET Password = PASSWORD(’newpass’) WHERE user = ‘root’;<br />
mysql&gt; FLUSH PRIVILEGES;</p>
<p>在丢失root密码的时候，可以这样<br />
mysqld_safe –skip-grant-tables&amp;<br />
mysql -u root mysql<br />
mysql&gt; UPDATE user SET password=PASSWORD(”new password”) WHERE user=’root’;<br />
mysql&gt; FLUSH PRIVILEGES;<br />
<h3 class="bsuite_related">Related items</h3>
<ul class="bsuite_related">
<li><a href='http://www.pkphp.com/2010/12/11/mysql%e4%b8%ad%e7%9a%84%e8%a1%a8%e6%98%be%e7%a4%ba%e2%80%9c%e4%bd%bf%e7%94%a8%e4%b8%ad%e2%80%9d%e8%a7%a3%e5%86%b3%e5%8a%9e%e6%b3%95%ef%bc%81/'>mysql中的表显示“使用中”解决办法！</a></li>
<li><a href='http://www.pkphp.com/2009/01/24/mysql_insert_id%e9%94%99%e8%af%af/'>mysql_insert_id()错误</a></li>
<li><a href='http://www.pkphp.com/2008/10/05/why-wordpress-so-slow/'>终于知道wordpress越来越慢的原因（一）</a></li>
<li><a href='http://www.pkphp.com/2008/10/04/mysql-slow-log/'>mysql慢速(slow log)脚本分析</a></li>
<li><a href='http://www.pkphp.com/2008/08/16/mysql%e4%b8%ad%e8%ae%be%e7%bd%ae%e8%87%aa%e5%a2%9e%e5%ad%97%e6%ae%b5/'>MySQL中设置自增字段</a></li>
</ul>
<a href="http://www.pkphp.com/2008/04/21/mysql%e4%bf%ae%e6%94%b9root%e5%af%86%e7%a0%81%e7%9a%84%e5%a4%9a%e7%a7%8d%e6%96%b9%e6%b3%95/" title="mysql 修改 root %" style="font-size: 13px;">mysql 修改 root %</a>(1)<a href="http://www.pkphp.com/2008/04/21/mysql%e4%bf%ae%e6%94%b9root%e5%af%86%e7%a0%81%e7%9a%84%e5%a4%9a%e7%a7%8d%e6%96%b9%e6%b3%95/" title="mysql修改root密码" style="font-size: 13px;">mysql修改root密码</a>(6)<a href="http://www.pkphp.com/2008/04/21/mysql%e4%bf%ae%e6%94%b9root%e5%af%86%e7%a0%81%e7%9a%84%e5%a4%9a%e7%a7%8d%e6%96%b9%e6%b3%95/" title="php root 密码" style="font-size: 13px;">php root 密码</a>(2)<a href="http://www.pkphp.com/2008/04/21/mysql%e4%bf%ae%e6%94%b9root%e5%af%86%e7%a0%81%e7%9a%84%e5%a4%9a%e7%a7%8d%e6%96%b9%e6%b3%95/" title="mysql 修改 root 密码" style="font-size: 13px;">mysql 修改 root 密码</a>(5)<a href="http://www.pkphp.com/2008/04/21/mysql%e4%bf%ae%e6%94%b9root%e5%af%86%e7%a0%81%e7%9a%84%e5%a4%9a%e7%a7%8d%e6%96%b9%e6%b3%95/" title="PHP 更改root密码" style="font-size: 13px;">PHP 更改root密码</a>(1)<a href="http://www.pkphp.com/2008/04/21/mysql%e4%bf%ae%e6%94%b9root%e5%af%86%e7%a0%81%e7%9a%84%e5%a4%9a%e7%a7%8d%e6%96%b9%e6%b3%95/" title="mysql 修改root 密码" style="font-size: 13px;">mysql 修改root 密码</a>(1)<a href="http://www.pkphp.com/2008/04/21/mysql%e4%bf%ae%e6%94%b9root%e5%af%86%e7%a0%81%e7%9a%84%e5%a4%9a%e7%a7%8d%e6%96%b9%e6%b3%95/" title="mysqladmin修改ROOT密码" style="font-size: 13px;">mysqladmin修改ROOT密码</a>(1)<a href="http://www.pkphp.com/2008/04/21/mysql%e4%bf%ae%e6%94%b9root%e5%af%86%e7%a0%81%e7%9a%84%e5%a4%9a%e7%a7%8d%e6%96%b9%e6%b3%95/" title="mysql 修改ROOT" style="font-size: 13px;">mysql 修改ROOT</a>(1)<a href="http://www.pkphp.com/2008/04/21/mysql%e4%bf%ae%e6%94%b9root%e5%af%86%e7%a0%81%e7%9a%84%e5%a4%9a%e7%a7%8d%e6%96%b9%e6%b3%95/" title="mysql 修改root密码" style="font-size: 13px;">mysql 修改root密码</a>(1)<a href="http://www.pkphp.com/2008/04/21/mysql%e4%bf%ae%e6%94%b9root%e5%af%86%e7%a0%81%e7%9a%84%e5%a4%9a%e7%a7%8d%e6%96%b9%e6%b3%95/" title="php root密码" style="font-size: 13px;">php root密码</a>(1)<a href="http://www.pkphp.com/2008/04/21/mysql%e4%bf%ae%e6%94%b9root%e5%af%86%e7%a0%81%e7%9a%84%e5%a4%9a%e7%a7%8d%e6%96%b9%e6%b3%95/" title="PHP记录登陆密码" style="font-size: 13px;">PHP记录登陆密码</a>(1)<a href="http://www.pkphp.com/2008/04/21/mysql%e4%bf%ae%e6%94%b9root%e5%af%86%e7%a0%81%e7%9a%84%e5%a4%9a%e7%a7%8d%e6%96%b9%e6%b3%95/" title="mysqladmin root 密码" style="font-size: 13px;">mysqladmin root 密码</a>(1)<a href="http://www.pkphp.com/2008/04/21/mysql%e4%bf%ae%e6%94%b9root%e5%af%86%e7%a0%81%e7%9a%84%e5%a4%9a%e7%a7%8d%e6%96%b9%e6%b3%95/" title="levitra" style="font-size: 13px;">levitra</a>(1)<a href="http://www.pkphp.com/2008/04/21/mysql%e4%bf%ae%e6%94%b9root%e5%af%86%e7%a0%81%e7%9a%84%e5%a4%9a%e7%a7%8d%e6%96%b9%e6%b3%95/" title="php mysql修改" style="font-size: 13px;">php mysql修改</a>(1)<a href="http://www.pkphp.com/2008/04/21/mysql%e4%bf%ae%e6%94%b9root%e5%af%86%e7%a0%81%e7%9a%84%e5%a4%9a%e7%a7%8d%e6%96%b9%e6%b3%95/" title="修改root密码" style="font-size: 13px;">修改root密码</a>(1)<br /><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql-optimization-script%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F04%2F21%2Fmysql%25E4%25BF%25AE%25E6%2594%25B9root%25E5%25AF%2586%25E7%25A0%2581%25E7%259A%2584%25E5%25A4%259A%25E7%25A7%258D%25E6%2596%25B9%25E6%25B3%2595%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql优化脚本！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F10%2F04%2Fmysql-slow-log%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F04%2F21%2Fmysql%25E4%25BF%25AE%25E6%2594%25B9root%25E5%25AF%2586%25E7%25A0%2581%25E7%259A%2584%25E5%25A4%259A%25E7%25A7%258D%25E6%2596%25B9%25E6%25B3%2595%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql慢速(slow log)脚本分析</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F07%2F28%2Fmysql%25E9%259A%258F%25E6%259C%25BA%25E6%259F%25A5%25E8%25AF%25A2%25E8%25BE%2593%25E5%2587%25BA%25E6%2595%25B0%25E6%258D%25AE%25E8%25AF%25AD%25E5%258F%25A5%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F04%2F21%2Fmysql%25E4%25BF%25AE%25E6%2594%25B9root%25E5%25AF%2586%25E7%25A0%2581%25E7%259A%2584%25E5%25A4%259A%25E7%25A7%258D%25E6%2596%25B9%25E6%25B3%2595%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql随机查询输出数据语句</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.pkphp.com%2F2008%2F08%2F16%2Fmysql%25E4%25B8%25AD%25E8%25AE%25BE%25E7%25BD%25AE%25E8%2587%25AA%25E5%25A2%259E%25E5%25AD%2597%25E6%25AE%25B5%2F&from=http%3A%2F%2Fwww.pkphp.com%2F2008%2F04%2F21%2Fmysql%25E4%25BF%25AE%25E6%2594%25B9root%25E5%25AF%2586%25E7%25A0%2581%25E7%259A%2584%25E5%25A4%259A%25E7%25A7%258D%25E6%2596%25B9%25E6%25B3%2595%2F" rel="nofollow">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">MySQL中设置自增字段</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件" rel="nofollow">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.pkphp.com/2008/04/21/mysql%e4%bf%ae%e6%94%b9root%e5%af%86%e7%a0%81%e7%9a%84%e5%a4%9a%e7%a7%8d%e6%96%b9%e6%b3%95/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

