<?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>Jean - 记录成长历程 &#187; mysql</title>
	<atom:link href="http://www.zhangyiqun.net/tag/mysql/feed" rel="self" type="application/rss+xml" />
	<link>http://www.zhangyiqun.net</link>
	<description>让世界更美好一点儿</description>
	<lastBuildDate>Wed, 07 Dec 2011 14:04:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>在Mysql运算中四舍五入</title>
		<link>http://www.zhangyiqun.net/1283.html</link>
		<comments>http://www.zhangyiqun.net/1283.html#comments</comments>
		<pubDate>Fri, 13 Aug 2010 03:58:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[脚本编程]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.zhangyiqun.net/?p=1283</guid>
		<description><![CDATA[今天在写客户返利系统，需要用到这方面的运算。 1.四舍五入 round(123.5) 2.舍去小数 floor(123.5) 3.如果小数部分有值就进一 ceil(123.5) 或者 ceiling(123.5) 示例 select round((select howmuch from fanli_userinfo where username='admin') * 192.7);<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.zhangyiqun.net%2F671.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F1283.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mysql ERROR 1062 (23000)</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.zhangyiqun.net%2F408.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F1283.html">
                        <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.zhangyiqun.net%2F468.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F1283.html">
                        <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.zhangyiqun.net%2F952.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F1283.html">
                        <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>今天在写客户返利系统，需要用到这方面的运算。</p>
<p>1.四舍五入 round(123.5)<br />
2.舍去小数 floor(123.5)<br />
3.如果小数部分有值就进一 ceil(123.5) 或者 ceiling(123.5) </p>
<p>示例</p>
<pre>
select round((select howmuch from fanli_userinfo where username='admin') * 192.7);
</pre>
<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.zhangyiqun.net%2F671.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F1283.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mysql ERROR 1062 (23000)</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.zhangyiqun.net%2F408.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F1283.html">
                        <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.zhangyiqun.net%2F468.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F1283.html">
                        <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.zhangyiqun.net%2F952.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F1283.html">
                        <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>]]></content:encoded>
			<wfw:commentRss>http://www.zhangyiqun.net/1283.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Can&#8217;t create/write to file &#8216;/tmp/#sql_b4c_0.MYD&#8217; (Errcode: 24)</title>
		<link>http://www.zhangyiqun.net/954.html</link>
		<comments>http://www.zhangyiqun.net/954.html#comments</comments>
		<pubDate>Sat, 16 Jan 2010 13:38:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web服务器]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.zhangyiqun.cn/?p=954</guid>
		<description><![CDATA[今天在尝试使用sqlyog时报错如下 Can&#8217;t create/write to file &#8216;/tmp/#sql_b4c_0.MYD&#8217; (Errcode: 24) 解决办法为 [mysqld] tmpdir=/path/to/tmp 今天才知道原来这种gui工具还需要在服务器上给划定一块临时空间<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.zhangyiqun.net%2F468.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F954.html">
                        <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.zhangyiqun.net%2F952.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F954.html">
                        <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.zhangyiqun.net%2F408.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F954.html">
                        <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.zhangyiqun.net%2F671.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F954.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mysql ERROR 1062 (23000)</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>今天在尝试使用sqlyog时报错如下</p>
<p>Can&#8217;t create/write to file &#8216;/tmp/#sql_b4c_0.MYD&#8217; (Errcode: 24)</p>
<p>解决办法为</p>
<pre>[mysqld]
tmpdir=/path/to/tmp</pre>
<p>今天才知道原来这种gui工具还需要在服务器上给划定一块临时空间</p>
<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.zhangyiqun.net%2F468.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F954.html">
                        <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.zhangyiqun.net%2F952.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F954.html">
                        <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.zhangyiqun.net%2F408.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F954.html">
                        <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.zhangyiqun.net%2F671.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F954.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mysql ERROR 1062 (23000)</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>]]></content:encoded>
			<wfw:commentRss>http://www.zhangyiqun.net/954.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>记录mysql和php的诡异问题</title>
		<link>http://www.zhangyiqun.net/956.html</link>
		<comments>http://www.zhangyiqun.net/956.html#comments</comments>
		<pubDate>Sat, 16 Jan 2010 08:46:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[工作笔记]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.zhangyiqun.cn/?p=956</guid>
		<description><![CDATA[Loaded Configuration File 被不明原因的指向某个目录下的php.ini ，无法更改，最后将php.ini移出那个目录后解决。但至今没有找到是哪个文件指定了php.ini ？ 让我连重现编译php都无法修改。 令一个问题是由mysql命令引起的，下面是来是php的报错： Warning: File &#8216;./cangjk/users.MYD&#8217; not found (Errcode: 24) query: SELECT u.*, s.* FROM users u INNER JOIN sessions s ON u.uid = s.uid WHERE s.sid = &#8217;675a70120ec04e0085f1b8a0ae2f596e&#8217; in /home/xiamnn/presite/html/cangjk/includes/presitebase.mysql.inc on line 141 Warning: session_start() [function.session-start]: Cannot send session cache limiter &#8211; headers already sent (output started at /home/xiamnn/presite/html/cangjk/includes/presitebase.mysql.inc:141) [...]<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.zhangyiqun.net%2F952.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F956.html">
                        <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.zhangyiqun.net%2F671.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F956.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mysql ERROR 1062 (23000)</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.zhangyiqun.net%2F517.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F956.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">新手谨慎购买php与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.zhangyiqun.net%2F1111.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F956.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP面向对象常规示例</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>Loaded Configuration File 被不明原因的指向某个目录下的php.ini ，无法更改，最后将php.ini移出那个目录后解决。但至今没有找到是哪个文件指定了php.ini ？ 让我连重现编译php都无法修改。</p>
<p>令一个问题是由mysql命令引起的，下面是来是php的报错：</p>
<p>Warning: File &#8216;./cangjk/users.MYD&#8217; not found (Errcode: 24) query: SELECT u.*, s.* FROM users u INNER JOIN sessions s ON u.uid = s.uid WHERE s.sid = &#8217;675a70120ec04e0085f1b8a0ae2f596e&#8217; in /home/xiamnn/presite/html/cangjk/includes/presitebase.mysql.inc on line 141<br />
<span id="more-956"></span></p>
<p>Warning: session_start() [function.session-start]: Cannot send session cache limiter &#8211; headers already sent (output started at /home/xiamnn/presite/html/cangjk/includes/presitebase.mysql.inc:141) in /home/xiamnn/presite/html/cangjk/includes/bootstrap.inc on line 1492</p>
<p>Warning: File &#8216;./cangjk/cache.MYD&#8217; not found (Errcode: 24) query: SELECT presite, created, headers, expire, serialized FROM cache WHERE cid = &#8216;variables&#8217; in /home/xiamnn/presite/html/cangjk/includes/presitebase.mysql.inc on line 141</p>
<p>Warning: File &#8216;./cangjk/variable.MYD&#8217; not found (Errcode: 24) query: SELECT * FROM variable in /home/xiamnn/presite/html/cangjk/includes/presitebase.mysql.inc on line 141</p>
<p>Warning: File &#8216;./cangjk/cache.MYD&#8217; not found (Errcode: 24) query: UPDATE cache SET presite = &#8221;, created = 1263630795, expire = 0, headers = &#8221;, serialized = 0 WHERE cid = &#8216;variables&#8217; in /home/xiamnn/presite/html/cangjk/includes/presitebase.mysql.inc on line 141</p>
<p>Warning: File &#8216;./cangjk/system.MYD&#8217; not found (Errcode: 24) query: SELECT name, filename, throttle FROM system WHERE type = &#8216;module&#8217; AND status = 1 AND bootstrap = 1 ORDER BY weight ASC, filename ASC in /home/xiamnn/presite/html/cangjk/includes/presitebase.mysql.inc on line 141</p>
<p>Warning: Cannot modify header information &#8211; headers already sent by (output started at /home/xiamnn/presite/html/cangjk/includes/presitebase.mysql.inc:141) in /home/xiamnn/presite/html/cangjk/includes/bootstrap.inc on line 767</p>
<p>Warning: Cannot modify header information &#8211; headers already sent by (output started at /home/xiamnn/presite/html/cangjk/includes/presitebase.mysql.inc:141) in /home/xiamnn/presite/html/cangjk/includes/bootstrap.inc on line 767</p>
<p>Warning: Cannot modify header information &#8211; headers already sent by (output started at /home/xiamnn/presite/html/cangjk/includes/presitebase.mysql.inc:141) in /home/xiamnn/presite/html/cangjk/includes/bootstrap.inc on line 767</p>
<p>Warning: File &#8216;./cangjk/url_alias.MYD&#8217; not found (Errcode: 24) query: SELECT dst FROM url_alias LIMIT 0, 1 in /home/xiamnn/presite/html/cangjk/includes/presitebase.mysql.inc on line 141</p>
<p>这是因为这台服务器曾经用yum安装过mysql，后来虽然被我卸载但是mysql命令还是留了下来。导致php调用mysql的时候还是使用的系统所残留的mysql命令，这就不难理解这个怪异现象了。</p>
<p>[root@www bin]# rm -rf mysql*</p>
<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.zhangyiqun.net%2F952.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F956.html">
                        <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.zhangyiqun.net%2F671.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F956.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mysql ERROR 1062 (23000)</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.zhangyiqun.net%2F517.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F956.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">新手谨慎购买php与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.zhangyiqun.net%2F1111.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F956.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP面向对象常规示例</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>]]></content:encoded>
			<wfw:commentRss>http://www.zhangyiqun.net/956.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysql如何删除用户？</title>
		<link>http://www.zhangyiqun.net/952.html</link>
		<comments>http://www.zhangyiqun.net/952.html#comments</comments>
		<pubDate>Fri, 15 Jan 2010 13:37:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web服务器]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.zhangyiqun.cn/?p=952</guid>
		<description><![CDATA[官方推荐的用法是 DROP USER user [, user] ... 但在我新迁移的mysql中没有效果，于是可以在use mysql的情况下 delete from user where HOST like &#8220;%jeantoe%&#8221;; 根据情况不同where的条件需要变化<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.zhangyiqun.net%2F671.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F952.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mysql ERROR 1062 (23000)</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.zhangyiqun.net%2F408.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F952.html">
                        <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.zhangyiqun.net%2F956.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F952.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">记录mysql和php的诡异问题</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.zhangyiqun.net%2F468.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F952.html">
                        <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>官方推荐的用法是</p>
<pre>DROP USER <em><code>user</code></em> [, <em><code>user</code></em>] ...</pre>
<p>但在我新迁移的mysql中没有效果，于是可以在use mysql的情况下</p>
<p>delete from user where HOST like &#8220;%jeantoe%&#8221;;</p>
<p>根据情况不同where的条件需要变化</p>
<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.zhangyiqun.net%2F671.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F952.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mysql ERROR 1062 (23000)</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.zhangyiqun.net%2F408.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F952.html">
                        <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.zhangyiqun.net%2F956.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F952.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">记录mysql和php的诡异问题</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.zhangyiqun.net%2F468.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F952.html">
                        <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>]]></content:encoded>
			<wfw:commentRss>http://www.zhangyiqun.net/952.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>悠游网Mysql优化手记</title>
		<link>http://www.zhangyiqun.net/740.html</link>
		<comments>http://www.zhangyiqun.net/740.html#comments</comments>
		<pubDate>Tue, 03 Nov 2009 12:09:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[工作笔记]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[优化]]></category>
		<category><![CDATA[架构]]></category>

		<guid isPermaLink="false">http://www.zhangyiqun.cn/?p=740</guid>
		<description><![CDATA[网站信息 2u4u.com.cn 为上海市中学生作文竞赛提供服务 平均访问量：2w/天 最高访问量：8w/天 平均数据量：2500 篇文章/天 最高日发文：7000篇文章/天 主要问题 1.并发不到100可引起服务器瘫痪 2.开网页速度过慢 3.mysql进程占用cpu和内存过多 友情提示：优化是一个整体，光优化mysql是不够的。 环境 centos 5.2 x64 , 8核,4G,1T SAS mysql 5.0.86 x64 my.cnf(只摘录关键部位) [mysqld] max_connections = 2048 max_connect_errors = 1024 open_files_limit = 4096 # # * Fine Tuning external-locking = FALSE #mysql短时间内可以保持多长的请求队列，与系统中tcp/ip连接队列有关 back_log = 1024 # sort_buffer_size = 16M join_buffer_size = 16M read_buffer_size = [...]<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.zhangyiqun.net%2F671.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F740.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mysql ERROR 1062 (23000)</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.zhangyiqun.net%2F408.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F740.html">
                        <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.zhangyiqun.net%2F952.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F740.html">
                        <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.zhangyiqun.net%2F1283.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F740.html">
                        <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[<h3>网站信息</h3>
<blockquote><p><a href="http://2u4u.com.cn" target="_blank">2u4u.com.cn</a></p>
<p>为上海市中学生作文竞赛提供服务</p>
<p>平均访问量：2w/天</p>
<p>最高访问量：8w/天</p>
<p>平均数据量：2500 篇文章/天</p>
<p>最高日发文：7000篇文章/天<br />
<span id="more-740"></span></p></blockquote>
<h3>主要问题</h3>
<blockquote><p>1.并发不到100可引起服务器瘫痪</p>
<p>2.开网页速度过慢</p>
<p>3.mysql进程占用cpu和内存过多</p>
<p>友情提示：优化是一个整体，光优化mysql是不够的。</p></blockquote>
<h3>环境</h3>
<blockquote><p>centos 5.2 x64 , 8核,4G,1T SAS</p>
<p>mysql 5.0.86 x64</p></blockquote>
<h3>my.cnf(只摘录关键部位)</h3>
<blockquote><p>[mysqld]<br />
max_connections = 2048<br />
max_connect_errors = 1024<br />
open_files_limit = 4096</p>
<p>#<br />
# * Fine Tuning<br />
external-locking = FALSE</p>
<p>#mysql短时间内可以保持多长的请求队列，与系统中tcp/ip连接队列有关</p>
<p>back_log = 1024</p>
<p>#</p>
<p>sort_buffer_size = 16M<br />
join_buffer_size = 16M<br />
read_buffer_size = 16M<br />
read_rnd_buffer_size = 16M<br />
myisam_sort_buffer_size = 512M<br />
wait_timeout=60<br />
myisam_repair_threads = 1<br />
skip-name-resolve<br />
back_log = 1024</p></blockquote>
<h3>后记</h3>
<p>对mysql优化后负载确实降下来了，但是因为初期架构和配置不合理服务器仍然无法承受太大的压力。在后面我又为其增加了cache层以及数据层，并且严格控制慢查询。才使得用户体验有了比较明显的变化。</p>
<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.zhangyiqun.net%2F671.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F740.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mysql ERROR 1062 (23000)</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.zhangyiqun.net%2F408.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F740.html">
                        <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.zhangyiqun.net%2F952.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F740.html">
                        <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.zhangyiqun.net%2F1283.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F740.html">
                        <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>]]></content:encoded>
			<wfw:commentRss>http://www.zhangyiqun.net/740.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>mysqldump基于时间点</title>
		<link>http://www.zhangyiqun.net/751.html</link>
		<comments>http://www.zhangyiqun.net/751.html#comments</comments>
		<pubDate>Tue, 20 Oct 2009 11:27:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[工作笔记]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.zhangyiqun.cn/?p=751</guid>
		<description><![CDATA[mysqldump -S /home/xxx/mysql/tmp/mysql.sock Com Weather  -w &#8220;Addtime&#62;1053376000&#8243; &#62; 123.sql<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.zhangyiqun.net%2F1283.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F751.html">
                        <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.zhangyiqun.net%2F468.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F751.html">
                        <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.zhangyiqun.net%2F952.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F751.html">
                        <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.zhangyiqun.net%2F408.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F751.html">
                        <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[<div class="comment-content wiki-content">
<p>mysqldump -S /home/xxx/mysql/tmp/mysql.sock Com Weather  -w &#8220;Addtime&gt;1053376000&#8243; &gt; 123.sql</p></div>
<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.zhangyiqun.net%2F1283.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F751.html">
                        <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.zhangyiqun.net%2F468.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F751.html">
                        <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.zhangyiqun.net%2F952.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F751.html">
                        <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.zhangyiqun.net%2F408.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F751.html">
                        <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>]]></content:encoded>
			<wfw:commentRss>http://www.zhangyiqun.net/751.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MONYOG配置指南</title>
		<link>http://www.zhangyiqun.net/678.html</link>
		<comments>http://www.zhangyiqun.net/678.html#comments</comments>
		<pubDate>Tue, 08 Sep 2009 12:43:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[工作笔记]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.zhangyiqun.cn/?p=678</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.zhangyiqun.net%2F468.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F678.html">
                        <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.zhangyiqun.net%2F408.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F678.html">
                        <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.zhangyiqun.net%2F671.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F678.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mysql ERROR 1062 (23000)</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.zhangyiqun.net%2F1283.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F678.html">
                        <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>很好的工具，目前国内用户似乎不多。</p>
<p>打红色的地方都需要重点注意</p>
<p><img class="alignnone" title="1" src="http://www.zhangyiqun.cn/wp-content/uploads/2009/09/MONYOG/1.JPG" alt="" width="560" height="433" /></p>
<p><span id="more-678"></span></p>
<p><a href="http://www.zhangyiqun.cn/wp-content/uploads/2009/09/MONYOG/1.JPG" rel="lightbox[678]"><img class="alignnone" title="2" src="http://www.zhangyiqun.cn/wp-content/uploads/2009/09/MONYOG/2.JPG" alt="" width="559" height="258" /></a></p>
<p><a href="http://www.zhangyiqun.cn/wp-content/uploads/2009/09/MONYOG/1.JPG" rel="lightbox[678]"><img class="alignnone" title="3" src="http://www.zhangyiqun.cn/wp-content/uploads/2009/09/MONYOG/3.JPG" alt="" width="559" height="438" /></a></p>
<p><a href="http://www.zhangyiqun.cn/wp-content/uploads/2009/09/MONYOG/4.JPG" rel="lightbox[678]"><img class="alignnone" title="4" src="http://www.zhangyiqun.cn/wp-content/uploads/2009/09/MONYOG/4.JPG" alt="" width="559" height="436" /></a></p>
<p><a href="http://www.zhangyiqun.cn/wp-content/uploads/2009/09/MONYOG/5.JPG" rel="lightbox[678]"><img class="alignnone" title="5" src="http://www.zhangyiqun.cn/wp-content/uploads/2009/09/MONYOG/5.JPG" alt="" width="560" height="328" /></a></p>
<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.zhangyiqun.net%2F468.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F678.html">
                        <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.zhangyiqun.net%2F408.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F678.html">
                        <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.zhangyiqun.net%2F671.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F678.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mysql ERROR 1062 (23000)</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.zhangyiqun.net%2F1283.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F678.html">
                        <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>]]></content:encoded>
			<wfw:commentRss>http://www.zhangyiqun.net/678.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mysql ERROR 1062 (23000)</title>
		<link>http://www.zhangyiqun.net/671.html</link>
		<comments>http://www.zhangyiqun.net/671.html#comments</comments>
		<pubDate>Fri, 04 Sep 2009 10:16:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux系统]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.zhangyiqun.cn/?p=671</guid>
		<description><![CDATA[问题描述 使用zcat将mysql数据导入时 ERROR 1062 (23000): Duplicate entry &#8217;255&#8242; for key 1 解决办法 解压出sql语句，进入mysql use db; source yoursqlfile; Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected (0.00 sec) Query OK, 0 [...]<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.zhangyiqun.net%2F952.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F671.html">
                        <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.zhangyiqun.net%2F431.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F671.html">
                        <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.zhangyiqun.net%2F1283.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F671.html">
                        <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.zhangyiqun.net%2F468.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F671.html">
                        <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>问题描述</p>
<p>使用zcat将mysql数据导入时</p>
<p>ERROR 1062 (23000): Duplicate entry &#8217;255&#8242; for key 1</p>
<p><span id="more-671"></span></p>
<p>解决办法</p>
<p>解压出sql语句，进入mysql</p>
<blockquote><p>use db;</p>
<p>source yoursqlfile;</p></blockquote>
<p>Query OK, 0 rows affected (0.00 sec)</p>
<p>Query OK, 0 rows affected (0.00 sec)</p>
<p>Query OK, 0 rows affected (0.00 sec)</p>
<p>Query OK, 0 rows affected (0.00 sec)</p>
<p>Query OK, 0 rows affected (0.00 sec)</p>
<p>Query OK, 0 rows affected (0.00 sec)</p>
<p>Query OK, 0 rows affected (0.00 sec)</p>
<p>&#8230;&#8230;</p>
<p>解决从数据库与主无法同步的问题</p>
<p>问题描述</p>
<p>090907  9:49:12 [ERROR] Error reading packet from server: Misconfigured master &#8211; server id was not set ( server_errno=1236)<br />
090907  9:49:12 [ERROR] Got fatal error 1236: &#8216;Misconfigured master &#8211; server id was not set&#8217; from master when reading data from binary log</p>
<p>解决办法</p>
<blockquote><p>为master添加server-id</p></blockquote>
<h3>与本文有关的日志</h3>
<h2 class="post"><a title="mysql" href="http://www.zhangyiqun.cn/468.html" target="_blank">MySQL 备份恢复同步一条龙</a></h2>
<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.zhangyiqun.net%2F952.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F671.html">
                        <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.zhangyiqun.net%2F431.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F671.html">
                        <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.zhangyiqun.net%2F1283.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F671.html">
                        <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.zhangyiqun.net%2F468.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F671.html">
                        <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>]]></content:encoded>
			<wfw:commentRss>http://www.zhangyiqun.net/671.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL 备份恢复同步一条龙</title>
		<link>http://www.zhangyiqun.net/468.html</link>
		<comments>http://www.zhangyiqun.net/468.html#comments</comments>
		<pubDate>Wed, 01 Jul 2009 03:08:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux系统]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.zhangyiqun.cn/?p=468</guid>
		<description><![CDATA[一 .概要 以某个slave 为基准，拷贝数据到其它slave，然后从 master 开始同步。 二 .导出过程 这里 以 db01 为基准， 以 db46 为 master 1. 记录 db01 mysql  show  slave status 的  &#8220;Master_Log_File&#8221;,&#8221;Read_Master_Log_Pos&#8221; 两项信息 1)   show slave status \G; 2. 从 db01 逐个库导出 DBS=&#8221;AhtycpDNS Buy FastLottery Lottery NewOkCom OlympicLottery Statistic UserInfo  okooo_admin proftpd static  voice&#8221; for db in $DBS ; do time    [...]<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.zhangyiqun.net%2F952.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F468.html">
                        <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.zhangyiqun.net%2F671.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F468.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mysql ERROR 1062 (23000)</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.zhangyiqun.net%2F431.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F468.html">
                        <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.zhangyiqun.net%2F408.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F468.html">
                        <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[<h3>一 .概要</h3>
<p>以某个slave 为基准，拷贝数据到其它slave，然后从 master 开始同步。</p>
<p><span id="more-468"></span></p>
<h3>二 .导出过程</h3>
<p>这里 以 db01 为基准， 以 db46 为 master</p>
<p>1. 记录 db01 mysql  show  slave status 的  &#8220;Master_Log_File&#8221;,&#8221;Read_Master_Log_Pos&#8221; 两项信息</p>
<p>1)   show slave status \G;</p>
<p>2. 从 db01 逐个库导出</p>
<p>DBS=&#8221;AhtycpDNS Buy FastLottery Lottery NewOkCom OlympicLottery Statistic UserInfo  okooo_admin proftpd static  voice&#8221;</p>
<p>for db in $DBS ; do time    mysqldump  -q &#8211;opt &#8211;default-character-set=latin1  &#8211;single-transaction &#8211;extended-insert=false &#8211;max_allowed_packet=64M  $db     | gzip &gt; $db.sql.gz  ;  done &amp;</p>
<p>3. 然后逐个库导入目标 slave，记录操作耗时等信息</p>
<p>DBS=&#8221;AhtycpDNS Buy FastLottery Lottery NewOkCom OlympicLottery Statistic UserInfo  okooo_admin proftpd static  voice&#8221;</p>
<p>for db in $DBS ; do time  zcat  $db.sql.gz |mysql &#8211;database=$db  ; done &amp;</p>
<p>4.为slave授权</p>
<pre class="code-java">grant replication slave on *.* to 'rep57'@'xxx' identified by 'xxx';</pre>
<h3>三.导入流程</h3>
<p>1.my.cnf文件，做红色标记的是为需要注意的地方。</p>
<blockquote>
<pre class="code-java">[client]
port    = 3306
socket  = /tmp/mysql.sock

[mysqld]
<span style="color: #ff0000;"><span class="code-keyword">default</span>-character-set = latin1</span>
<span style="color: #ff0000;">user = okooo port = 3306</span>
socket  = /tmp/mysql.sock
basedir = /home/okooo/apps/mysql/
datadir = /home/okooo/apps/mysql/data
open_files_limit    = 10240
back_log = 600
max_connections = 3000
max_connect_errors = 6000
table_cache = 614
external-locking = FALSE
max_allowed_packet = 32M
sort_buffer_size = 2M
join_buffer_size = 2M
thread_cache_size = 300
thread_concurrency = 8
query_cache_size = 32M
query_cache_limit = 2M
query_cache_min_res_unit = 2k
<span class="code-keyword">default</span>-storage-engine = MyISAM
default_table_type = MyISAM
thread_stack = 192K
transaction_isolation = READ-COMMITTED
tmp_table_size = 246M
max_heap_table_size = 246M
long_query_time = 1
log_long_format
expire_logs_days = 7
key_buffer_size = 256M
read_buffer_size = 1M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_max_extra_sort_file_size = 30G
myisam_repair_threads = 1
myisam_recover

skip-name-resolve

#start slave

server-id = 77
master-host     =  xxx
<span style="color: #ff0000;">master-user = rep57 master-password = xxx</span>
replicate-ignore-db=mysql
skip-slave-start
slave-skip-errors = 1032,1062,126,1114,1146,1048,1396
master-connect-retry = 10
master-retry-count              = 100000000
slave_net_timeout       = 20

#stop slave

innodb_additional_mem_pool_size = 16M
innodb_buffer_pool_size = 2048M
innodb_data_file_path = ibdata1:1024M:autoextend
innodb_file_io_threads = 4
innodb_thread_concurrency = 8
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 16M
innodb_log_file_size = 128M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
innodb_file_per_table = 0
[mysqldump]
quick
max_allowed_packet = 32M</pre>
</blockquote>
<p>2.在启动 slave 时 ，设置 &#8220;Master_Log_File&#8221;,&#8221;Read_Master_Log_Pos&#8221; 这两项为第1步记录的值</p>
<p>1) CHANGE MASTER TO MASTER_LOG_FILE = &#8216;logbin.xxxxxxx&#8217;, MASTER_LOG_POS = xxxxxxxx ;</p>
<p>2) CHANGE MASTER TO MASTER_USER=&#8217;rep57&#8242;;</p>
<p>3) start slave;</p>
<p>5. 持续观察同步结果一段时间, 无误后做 一致性检查</p>
<p>show  slave status</p>
<p>6. 重复 3~5步，直至所有 slave 同步状态正常</p>
<h3>下面开始是一个mysql主从配置的标准流程</h3>
<p>1.在maste主机上，配置my.cnf<br />
在[mysqld]配置段添加如下字段中增加</p>
<p>log-bin=mysql-bin.log<br />
binlog-do-db=blog #要同步的数据库的名字<br />
binlog-do-db=index #要同步的数据库的名字</p>
<p>server-id=1</p>
<p>重启mysql</p>
<p>#service mysqld restart<br />
进入mysql中</p>
<p>#mysql -u root -ppassword<br />
增加同步帐号</p>
<p>mysql&gt;grant replication slave on *.* to &#8216;repication&#8217;@'%&#8217; identified by &#8216;password&#8217;;<br />
mysql&gt;use database;<br />
mysql&gt;flush tables with read lock;<br />
mysql&gt;show master status:</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
| mysql-bin.000002 | 1448 | blog,index | |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+</p>
<p>此时不要关闭此终端！<br />
记住上表前两个字段的信息 mysql-bin.000002 和 1448 。<br />
另开一个终端：</p>
<p>拿到主数据库上的“数据库快照”</p>
<p>#tar -czvf database.tar.gz /data/database</p>
<p>切换到上一个终端<br />
mysql&gt;unlock tables; #解锁，让主数据库192.168.1.10上的数据库正常更新</p>
<p>2.配置slave数据库</p>
<p>首先创建数据库</p>
<p>#mysql -uroot -ppassword<br />
mysql&gt;create database databasename #建一个与主服务器的数据库名字相同的数据库<br />
mysql&gt;exit;</p>
<p>3.在两个从数据库的[mysqld]配置段添加如下字段中增加</p>
<p># 192.168.1.11<br />
server-id=2<br />
master-host=192.168.1.10<br />
master-user=replication<br />
master-password=password<br />
master-connect-retry=60<br />
replicate-do-db=blog<br />
replicate-do-db=index</p>
<p>#192.168.1.12<br />
server-id=3<br />
master-host=192.168.1.10<br />
master-user=replication<br />
master-password=password<br />
master-connect-retry=60<br />
replicate-do-db=blog<br />
replicate-do-db=index</p>
<p>3.分别重启两个数据库</p>
<p>#service mysqld restart</p>
<p>4.分别进入两个从数据库中</p>
<p>在salve2上</p>
<p>#mysql -uroot -ppassword<br />
mysql&gt;slave stop;<br />
&gt; CHANGE MASTER TO<br />
&gt; MASTER_HOST=&#8217;192.168.1.10&#8242;,<br />
&gt; MASTER_USER=&#8217;replication&#8217;,<br />
&gt; MASTER_PASSWORD=&#8217;password&#8217;,<br />
&gt; MASTER_LOG_FILE=&#8217;mysql-bin.000002&#8242;,<br />
&gt; MASTER_LOG_POS=1448;</p>
<p>MYSQL&gt;START SLAVE;</p>
<p>在salve2上</p>
<p>#mysql -uroot -ppassword<br />
mysql&gt;slave stop;<br />
&gt; CHANGE MASTER TO<br />
&gt; MASTER_HOST=&#8217;192.168.1.10&#8242;,<br />
&gt; MASTER_USER=&#8217;replication&#8217;,<br />
&gt; MASTER_PASSWORD=&#8217;password&#8217;,<br />
&gt; MASTER_LOG_FILE=&#8217;mysql-bin.000002&#8242;,<br />
&gt; MASTER_LOG_POS=1448;</p>
<p>MYSQL&gt;START SLAVE;</p>
<p>在slave端 ：</p>
<p>mysql&gt; show processlist;<br />
+&#8212;-+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
| Id | User | Host | db | Command | Time | State | Info |<br />
+&#8212;-+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
| 4 | system user | | NULL | Connect | 48 | Waiting for master to send event | NULL |<br />
| 5 | system user | | NULL | Connect | 4294923022 | Has read all relay log; waiting for the slave I/O thread to update it | NULL |<br />
| 6 | root | localhost | NULL | Query | 0 | NULL | show processlist |<br />
+&#8212;-+&#8212;&#8212;&#8212;&#8212;-+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
以上信息表示同步成功！</p>
<p>4.同步测试过程<br />
分别在主数据库上建立一个表，插入一条数据<br />
在两个从数据库上看看是否更新<br />
过程略。</p>
<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.zhangyiqun.net%2F952.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F468.html">
                        <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.zhangyiqun.net%2F671.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F468.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mysql ERROR 1062 (23000)</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.zhangyiqun.net%2F431.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F468.html">
                        <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.zhangyiqun.net%2F408.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F468.html">
                        <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>]]></content:encoded>
			<wfw:commentRss>http://www.zhangyiqun.net/468.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Mysql实战笔记（管理与维护）</title>
		<link>http://www.zhangyiqun.net/431.html</link>
		<comments>http://www.zhangyiqun.net/431.html#comments</comments>
		<pubDate>Sun, 21 Jun 2009 11:33:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web服务器]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[数据库]]></category>

		<guid isPermaLink="false">http://www.zhangyiqun.cn/?p=431</guid>
		<description><![CDATA[linux下的安装 rpm 安装路径不灵活 二进制 灵活性好，直接使用即可 ./scripts/mysql_install_db &#8211;user=okooo 注意log和tmp的目录设置 源码 最灵活，性能最好，根据需要定制编译。下面是一个比较稳妥和普遍的编译指令。 ./configure &#8211;prefix=/usr/local/webserver/mysql/ &#8211;enable-assembler &#8211;with-extra-charsets=complex &#8211;enable-thread-safe-client &#8211;with-big-tables &#8211;with-readline &#8211;with-ssl &#8211;with-embedded-server &#8211;enable-local-infile &#8211;with-plugins=innobase 常用命令 因模板对特殊符号（&#8211;）支持的不好，所以当命令无法执行时请把单-换成双- 查看服务器参数值：show variables; 查看服务器运行状态：show status; shell下直接查看数据库状态：mysqladmin -uroot variables 查看当前连接的用户：select current_user(); 查看当前使用的数据库：select database(); 查询用户：select user,host from user; 查询正在执行的语句：show processlist; 查询数据库和表的统计信息：mysqlshow -uroot &#8211;count 查询数据库中表的信息：mysqlshow -uroot test &#8211;count 查询具体表结构：desc 表名; 查询错误号：perror 30 启动mysql：bin/safe_mysqld &#8211;user=mysql &#38; 帮助：mysqld [...]<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.zhangyiqun.net%2F1283.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F431.html">
                        <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.zhangyiqun.net%2F671.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F431.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mysql ERROR 1062 (23000)</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.zhangyiqun.net%2F952.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F431.html">
                        <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.zhangyiqun.net%2F408.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F431.html">
                        <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[<h3>linux下的安装</h3>
<p>rpm 安装路径不灵活</p>
<p>二进制 灵活性好，直接使用即可</p>
<blockquote><p>./scripts/mysql_install_db &#8211;user=okooo 注意log和tmp的目录设置</p></blockquote>
<p>源码 最灵活，性能最好，根据需要定制编译。下面是一个比较稳妥和普遍的编译指令。</p>
<blockquote><p>./configure &#8211;prefix=/usr/local/webserver/mysql/ &#8211;enable-assembler &#8211;with-extra-charsets=complex &#8211;enable-thread-safe-client &#8211;with-big-tables &#8211;with-readline &#8211;with-ssl &#8211;with-embedded-server &#8211;enable-local-infile &#8211;with-plugins=innobase</p></blockquote>
<p><span id="more-431"></span></p>
<h3>常用命令</h3>
<p><span style="color: #ff0000;">因模板对特殊符号（&#8211;）支持的不好，所以当命令无法执行时请把单-换成双-</span></p>
<p>查看服务器参数值：show variables;</p>
<p>查看服务器运行状态：show status;</p>
<p>shell下直接查看数据库状态：mysqladmin -uroot variables</p>
<p>查看当前连接的用户：select current_user();</p>
<p>查看当前使用的数据库：select database();</p>
<p>查询用户：select user,host from user;</p>
<p>查询正在执行的语句：show processlist;</p>
<p>查询数据库和表的统计信息：mysqlshow -uroot &#8211;count</p>
<p>查询数据库中表的信息：mysqlshow -uroot test &#8211;count</p>
<p>查询具体表结构：desc 表名;</p>
<p>查询错误号：perror 30</p>
<p>启动mysql：bin/safe_mysqld &#8211;user=mysql &amp;</p>
<p>帮助：mysqld &#8211;verbose &#8211;help</p>
<p>查看默认的存储引擎：mysql&gt; show variables like &#8216;table_type&#8217;;</p>
<p>当前数据库支持的引擎：mysql&gt; show ENGINES \G;</p>
<p>涉及到修改数据库的常用命令</p>
<p>将wp_posts表中post_content字段中文字”old”替换为”new” ：update wp_posts set post_content=replace(post_content,’old’,’new’)</p>
<p>更改表名：rename table 原表名 to 新表名;</p>
<p><strong>数据库导入导出</strong></p>
<p>导出以voice库为例</p>
<p>[root@jeantoe ~]# mkdir DUMPDIR &amp;&amp; cd DUMPDIR</p>
<p>[root@jeantoe ~]# mysqldump  -q &#8211;opt &#8211;default-character-set=latin1  &#8211;single-transaction &#8211;extended-insert=false &#8211;max_allowed_packet=64M voice    | gzip &gt; voice.sql.gz</p>
<p>导入</p>
<p>[root@jeantoe ~]# mysqladmin create voice</p>
<p>[root@jeantoe ~]# <span style="color: #000000; font-family: Segoe UI;">zcat voice.sql.gz | mysql  -uroot &#8211;database=voice</span></p>
<p><span style="color: #000000; font-family: Segoe UI;">在进行大数据导入时使用renice 把进程优先级调高（范围是19到-20）</span></p>
<p>[root@jeantoe ~]#renice -20 888</p>
<h3>Mysql Tips</h3>
<p>免登录执行sql语句(shell)</p>
<blockquote><p>mysql -u root -p 123 -e &#8220;&#8230;&#8221;</p></blockquote>
<p>错误处理(批量sql语句)</p>
<blockquote><p>-f 强制执行sql<br />
-v显示出错语句<br />
&#8211;show-warnings全部错误信息</p></blockquote>
<p>myisam表压缩，压后无法DML<br />
mysqladmin<br />
mysqlbinlog 日志管理<br />
mysqlcheck (myisam维护，优化，分析)<br />
mysqldump<br />
mysqlhotcopy (myisam表热备份)<br />
mysqlimport (数据库导入)<br />
mysqlshow (数据库对象查看)<br />
perror (错误代码查看)<br />
replace (文本替换)</p>
<h3>日志</h3>
<p>错误日志：普通，系统故障时查看<br />
二进制日志：记录了DDL和DML语句，不包括数据库查询语句，此日志对于灾难恢复极有用。<br />
查询日志：记录客户端所有语句，默认关闭，影响性能<br />
慢查询日志：记录时间超过long_query_time的日志，通常开启，分析性能问题</p>
<h3>备份与恢复</h3>
<p>策略<br />
1.确定引擎，不同引擎处理数据一致性方面是不太一样的。<br />
2.确定全备份或增量备份<br />
3.备份周期<br />
4.开启log-bin (rpm安装时日志的默认位置比较诡异/var/lib/mysql/log_bin)<br />
5.经常作恢复测试，确保备份是有效的。</p>
<p>逻辑备份和恢复(速度慢)<br />
1.mysqldump 最常用<br />
2.基于时间点mysqlbinlog &#8211;stop-date=&#8221;时间&#8221; /日志 | mysql -u root -p<br />
3.基于位置mysqlbinlog &#8211;start-date=&#8221;时间&#8221; &#8211;stop-date=&#8221;时间&#8221; /日志 &gt; /tmp/mysql_restore.sql</p>
<p>物理备份(兼容性问题)</p>
<p>1.冷备份cp<br />
2.热备份<br />
MYISAM引擎。本质上是将要备份的表加读锁，然后再cp数据文件到备份目录。通常使用mysqlhotcopy。在前者使用不正常时则手工加读锁(flush tables for read;)。<br />
innoDB，通常使用ibbackup，缺点是收费因此普及率不高。</p>
<p>表的导入和导出</p>
<p>SELECT &#8230; INTO OUTFILE<br />
LOAD DATA INFILE<br />
<strong>跨平台操作时注意设置line-terminated-by</strong></p>
<h3>安全</h3>
<p>1.不以root权限运行mysql<br />
2.防止DNS欺骗<br />
3.删除匿名帐号<br />
4.只授予帐号必须的权限<br />
5.除root外任何人不应该有mysql库和user表的存取权限<br />
6.不把FILE,PROCESS或SUPER授予除管理员以外的帐号<br />
7.DROP TABLE并不收回以前的相关访问授权<br />
8.使用SSL<br />
9.访问限制（HOST）<br />
10.注意REVOKE漏洞</p>
<h3>mysql常见问题总结</h3>
<p>1.忘记mysql的root密码<br />
&#8211;skip-grant-tables</p>
<p>2.myISAM表损坏<br />
myisamchk -r tablename活myisamchk -o tablename</p>
<p>3.myISAM表超过4G无法访问<br />
alter table tbl_name MAX_ROWS=&#8230;&#8230;</p>
<p>4.DNS反向解析引起的宕机<br />
&#8211;skip-name-resolve</p>
<p>5.mysql.sock丢失<br />
mysql &#8211;protocol=TCP -uroot -p3306 -hlocalhost</p>
<h3>优化（未实践）</h3>
<p>1.去掉不需要的模块<br />
2.只选择需要使用的字符集<br />
3.静态编译，然而，如果希望装入用户自定义的函数，则不能使用静态二进制系统，因为 UDF 机制依赖于动态连接</p>
<h3>升级p325</h3>
<p>方法一：通过网络</p>
<p>1.在新mysql中创建和老版本相同的数据库<br />
mysqladmin -h hostname -P port -u user -p passwd create db_name<br />
老版mysql中执行<br />
mysqldump &#8211;opt db_name | mysql -h hostname -P port -u user -p passwd db_name<br />
2.cp原mysql数据库目录覆盖新版mysql目录<br />
以rpm包的位置为例，cp -R /var/lib/old_mysql/ /var/lib/new_mysql<br />
3.mysql_fix_privilege_tables升级权限表</p>
<p style="margin:0;padding:0;height:1px;overflow:hidden;">
    <script type="text/javascript"><!--
        var wumiiSitePrefix = "http://www.zhangyiqun.net";
        var wumiiEnableCustomPos = false;
        var wumiiParams = "&#038;num=4&#038;mode=3&#038;displayInFeed=1&#038;version=1.0.5.5&#038;pf=WordPress3.2.1";
    //--></script><script type="text/javascript" src="http://widget.wumii.com/ext/relatedItemsWidget.htm"></script><a href="http://www.wumii.com/widget/relatedItems.htm" style="border:0;"><img src="http://static.wumii.com/images/pixel.png" alt="无觅相关文章插件，快速提升流量" style="border:0;padding:0;margin:0;" /></a></p>
<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.zhangyiqun.net%2F1283.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F431.html">
                        <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.zhangyiqun.net%2F671.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F431.html">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mysql ERROR 1062 (23000)</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.zhangyiqun.net%2F952.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F431.html">
                        <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.zhangyiqun.net%2F408.html&from=http%3A%2F%2Fwww.zhangyiqun.net%2F431.html">
                        <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>]]></content:encoded>
			<wfw:commentRss>http://www.zhangyiqun.net/431.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced

Served from: www.zhangyiqun.net @ 2012-02-07 22:40:26 -->
