<?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>MySQL支持 &#187; MySQL基础</title>
	<atom:link href="http://www.mysqlsupport.cn/category/base/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mysqlsupport.cn</link>
	<description>MySQL支持，提供专业技术支持性能调优，架构设计</description>
	<lastBuildDate>Wed, 26 Oct 2011 12:23:33 +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.mysqlsupport.cn/mysql-benchmark/</link>
		<comments>http://www.mysqlsupport.cn/mysql-benchmark/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 07:12:35 +0000</pubDate>
		<dc:creator>wubx</dc:creator>
				<category><![CDATA[MySQL基础]]></category>
		<category><![CDATA[测试]]></category>
		<category><![CDATA[MySQL测试]]></category>

		<guid isPermaLink="false">http://www.mysqlsupport.cn/?p=142</guid>
		<description><![CDATA[作者：吴炳锡　来源:http://www.mysqlsupport.cn/ 联系方式： wubingxi#gmail.com 转载请注:译者和出处，并且不能用于商业用途，违者必究. 压力测试的目的： 通过压力测试了解一下不同发行版本的性能区别。 MySQL不的版本测试,MySQL同样的配置 具体版本如下： MySQL-5.1.42企业版＋innodb-plugin MySQL-5.1.42企业版＋默认的innodb MySQL-5.1.43开源版+ innodb-plugin MySQL-5.1.43 Percona 操作系统： Redhat Enterprise 5.4 硬件： Dell R710，RAM：48G，硬盘：6块SAS做Radid10 压力设置 创建一个1kw的Innodb表,使用16个并发去进行读取写入更新事务方面的操作. 测试工具: Sysbench 测试方法: 创建数据: time sysbench --mysql-user=root --mysql-host=localhost --test=oltp --oltp-test-mode=complex --mysql-table-engine=innodb --oltp-table-size=10000000 --mysql-db=test --oltp-table-name=innodb_1kw --num-threads=16 --max-requests=500000 preware 测试: time sysbench --mysql-user=root --mysql-host=localhost --test=oltp --oltp-test-mode=complex --mysql-table-engine=innodb --oltp-table-size=10000000 --mysql-db=test --oltp-table-name=innodb_1kw --num-threads=16 --max-requests=500000 run MySQL的基本配置 [...]]]></description>
			<content:encoded><![CDATA[<p><strong>作者：吴炳锡　来源:http://www.mysqlsupport.cn/ 联系方式： wubingxi#gmail.com 转载请注:译者和出处，并且不能用于商业用途，违者必究.</strong></p>
<p><strong>压力测试的目的：</strong><br />
通过压力测试了解一下不同发行版本的性能区别。<br />
MySQL不的版本测试,MySQL同样的配置<br />
<strong>具体版本如下：</strong><br />
MySQL-5.1.42企业版＋innodb-plugin<br />
MySQL-5.1.42企业版＋默认的innodb<br />
MySQL-5.1.43开源版+ innodb-plugin<br />
MySQL-5.1.43 Percona<br />
操作系统：<br />
Redhat Enterprise 5.4<br />
硬件： Dell R710，RAM：48G，硬盘：6块SAS做Radid10</p>
<p><strong>压力设置</strong><br />
创建一个1kw的Innodb表,使用16个并发去进行读取写入更新事务方面的操作.<br />
测试工具:<br />
Sysbench<br />
<strong>测试方法:</strong><br />
创建数据:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">time sysbench --mysql-user=root --mysql-host=localhost --test=oltp --oltp-test-mode=complex --mysql-table-engine=innodb --oltp-table-size=10000000 --mysql-db=test --oltp-table-name=innodb_1kw --num-threads=16 --max-requests=500000 preware</pre></div></div>

<p><strong>测试:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">time sysbench --mysql-user=root --mysql-host=localhost --test=oltp --oltp-test-mode=complex --mysql-table-engine=innodb --oltp-table-size=10000000 --mysql-db=test --oltp-table-name=innodb_1kw --num-threads=16 --max-requests=500000 run</pre></div></div>

<p><strong>MySQL的基本配置</strong></p>
<p>innodb_buffer_pool_size = 30G<br />
innodb_data_file_path = ibdata1:1G:autoextend<br />
transaction_isolation = READ-COMMITTED<br />
innodb_thread_concurrency = 16<br />
innodb_flush_log_at_trx_commit = 1<br />
innodb_log_buffer_size = 8M<br />
innodb_log_file_size = 256M<br />
innodb_log_files_in_group = 3<br />
innodb_log_group_home_dir=/u1/mysqlp/logs/<br />
innodb_max_dirty_pages_pct = 75<br />
innodb_flush_method=O_DIRECT<br />
innodb_lock_wait_timeout = 20<br />
innodb_file_per_table = 1<br />
启用innodb-plugin,innodb-plugin的版本号为：1.0.6</p>
<p><strong>测试结果</strong><br />
分别测试三次,取平均值:</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="160" valign="top">版本</td>
<td width="160" valign="top">事务/秒</td>
<td width="160" valign="top">写入读取/秒</td>
<td width="160" valign="top">其它操作/秒</td>
</tr>
<tr>
<td width="160" valign="top">MySQL企业版Innodb</td>
<td width="160" valign="top">1882.32</td>
<td width="160" valign="top">35764.1</td>
<td width="160" valign="top">3764.64</td>
</tr>
<tr>
<td width="160" valign="top">MySQL企业版Innodb-plugin</td>
<td width="160" valign="top">2395.073</td>
<td width="160" valign="top">45506.45</td>
<td width="160" valign="top">4790.15</td>
</tr>
<tr>
<td width="160" valign="top">MySQL开源版innodb-plugin</td>
<td width="160" valign="top">2288.09</td>
<td width="160" valign="top">43473.72</td>
<td width="160" valign="top">4576.18</td>
</tr>
<tr>
<td width="160" valign="top">Precona-MySQL</td>
<td width="160" valign="top">2754.24</td>
<td width="160" valign="top">52330.52</td>
<td width="160" valign="top">5508.48</td>
</tr>
</tbody>
</table>
<p>1kw 写入的速度</p>
<table border="1" cellspacing="0" cellpadding="0" width="515">
<tbody>
<tr>
<td width="195">版本</td>
<td width="153">写入1kw数据总时间</td>
<td width="87">用户</td>
<td width="80">系统</td>
</tr>
<tr>
<td width="195">MySQL企业版Innodb</td>
<td width="153">3m25.318s</td>
<td width="87">0m1.953s</td>
<td width="80">0m0.177s</td>
</tr>
<tr>
<td width="195">MySQL企业版Innodb-plugin</td>
<td width="153">3m0.077s</td>
<td width="87">0m1.783s</td>
<td width="80">0m0.081s</td>
</tr>
<tr>
<td width="195">MySQL开源版Innodb-plugin</td>
<td width="153">3m0.169s</td>
<td width="87">0m1.882s</td>
<td width="80">0m0.125s</td>
</tr>
<tr>
<td width="195">Precona-MySQL</td>
<td width="153">3m0.030s</td>
<td width="87">0m1.979s</td>
<td width="80">0m0.192s</td>
</tr>
</tbody>
</table>
<p>结果分析<br />
事务对比:<br />
<img class="alignnone size-full wp-image-143" title="transcation" src="http://www.mysqlsupport.cn/wp-content/uploads/2010/03/transcation.JPG" alt="transcation" width="526" height="346" /><br />
写入读取对比:<br />
<img class="alignnone size-full wp-image-144" title="readwrite" src="http://www.mysqlsupport.cn/wp-content/uploads/2010/03/readwrite.JPG" alt="readwrite" width="524" height="351" /><br />
其它操作对比:<br />
<img class="alignnone size-full wp-image-145" title="other" src="http://www.mysqlsupport.cn/wp-content/uploads/2010/03/other.JPG" alt="other" width="516" height="376" /><br />
MySQL的开源版和企业版的Innodb性能相差不大，所以这里不在单独比较。总的来看Precona的MySQL性能表现良好。针对Innodb－plugin的的比较MySQL的企业版少表现比较好一点。从数据上来看选择不同的版本性能上最大的区别基本接近2倍。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mysqlsupport.cn/mysql-benchmark/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Relay log read failure的处理</title>
		<link>http://www.mysqlsupport.cn/relay-log-read-failure/</link>
		<comments>http://www.mysqlsupport.cn/relay-log-read-failure/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 08:35:47 +0000</pubDate>
		<dc:creator>wubx</dc:creator>
				<category><![CDATA[MySQL TIPS/FAQ]]></category>
		<category><![CDATA[MySQL同步]]></category>
		<category><![CDATA[MySQL基础]]></category>
		<category><![CDATA[同步中的Bug]]></category>

		<guid isPermaLink="false">http://www.mysqlsupport.cn/?p=59</guid>
		<description><![CDATA[作者：吴炳锡　来源：http://www.mysqlsupport.cn/ 联系方式：select unhex(’777562696E67786940676D61696C2E636F6D’); 载请注明作/译者和出处，并且不能用于商业用途，违者必究。        众所周知MySQL5.1的Replication是比较烂的。MySQL的每一个版本更新关于同步方面每次都是可以看到一大堆。但MySQL 5.1性能是比较突出的。所以经不住诱惑使用MySQL 5.1。所以也要经常遇到一些Bug。如：  mysql&#62; show slave status\G *************************** 1. row ***************************                Slave_IO_State: Waiting for master to send event                   Master_Host: 192.168.10.118                   Master_User: repl_wu                   Master_Port: 3306                 Connect_Retry: 30               Master_Log_File: mysql-bin.005121           Read_Master_Log_Pos: 64337286                Relay_Log_File: relay-bin.003995                 Relay_Log_Pos: 18446697137031827760         Relay_Master_Log_File: mysql-bin.005121              Slave_IO_Running: Yes             [...]]]></description>
			<content:encoded><![CDATA[<p><strong>作者：吴炳锡　来源：</strong><a href="http://www.mysqlsupport.cn/"><strong>http://www.mysqlsupport.cn/</strong></a><strong> </strong><strong>联系方式：</strong><strong>select unhex(’777562696E67786940676D61696C2E636F6D’); </strong><strong>载请注明作</strong><strong>/</strong><strong>译者和出处，并且不能用于商业用途，违者必究。</strong><br />
       众所周知MySQL5.1的Replication是比较烂的。MySQL的每一个版本更新关于同步方面每次都是可以看到一大堆。但MySQL 5.1性能是比较突出的。所以经不住诱惑使用MySQL 5.1。所以也要经常遇到一些Bug。如： </p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;">mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">show</span> slave <span style="color: #990099; font-weight: bold;">status</span>\G
<span style="color: #CC0099;">***************************</span> <span style="color: #008080;">1</span>. row <span style="color: #CC0099;">***************************</span>
               Slave_IO_State: Waiting for master <span style="color: #990099; font-weight: bold;">to</span> send event
                  Master_Host: 192.168.10.118
                  Master_User: repl_wu
                  Master_Port: <span style="color: #008080;">3306</span>
                Connect_Retry: <span style="color: #008080;">30</span>
              Master_Log_File: mysql<span style="color: #CC0099;">-</span><span style="color: #000099;">bin</span><span style="color: #008080;">.005121</span>
          Read_Master_Log_Pos: <span style="color: #008080;">64337286</span>
               Relay_Log_File: relay<span style="color: #CC0099;">-</span><span style="color: #000099;">bin</span><span style="color: #008080;">.003995</span>
                Relay_Log_Pos: <span style="color: #008080;">18446697137031827760</span>
        Relay_Master_Log_File: mysql<span style="color: #CC0099;">-</span><span style="color: #000099;">bin</span><span style="color: #008080;">.005121</span>
             Slave_IO_Running: Yes
            Slave_SQL_Running: <span style="color: #990099; font-weight: bold;">No</span>
              Replicate_Do_DB:
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table:
  Replicate_Wild_Ignore_Table:
                   Last_Errno: <span style="color: #008080;">1594</span>
                   Last_Error: Relay <span style="color: #000099;">log</span> <span style="color: #990099; font-weight: bold;">read</span> failure: Could <span style="color: #CC0099; font-weight: bold;">not</span> parse relay <span style="color: #000099;">log</span> event entry. The possible reasons are: the master<span style="color: #008000;">'s binary log is corrupted (you can check this by running '</span>mysqlbinlog<span style="color: #008000;">' on the binary log), the slave'</span>s relay <span style="color: #000099;">log</span> <span style="color: #CC0099; font-weight: bold;">is</span> corrupted <span style="color: #FF00FF;">&#40;</span>you can <span style="color: #990099; font-weight: bold;">check</span> this by running <span style="color: #008000;">'mysqlbinlog'</span> <span style="color: #990099; font-weight: bold;">on</span> the relay <span style="color: #000099;">log</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span> a network problem<span style="color: #000033;">,</span> <span style="color: #CC0099; font-weight: bold;">or</span> a bug <span style="color: #990099; font-weight: bold;">in</span> the master<span style="color: #008000;">'s or slave'</span>s MySQL code. <span style="color: #009900;">If</span> you want <span style="color: #990099; font-weight: bold;">to</span> <span style="color: #990099; font-weight: bold;">check</span> the master<span style="color: #008000;">'s binary log or slave'</span>s relay <span style="color: #000099;">log</span><span style="color: #000033;">,</span> you will be able <span style="color: #990099; font-weight: bold;">to</span> know their names by issuing <span style="color: #008000;">'SHOW SLAVE STATUS'</span> <span style="color: #990099; font-weight: bold;">on</span> this slave.
                 Skip_Counter: <span style="color: #008080;">0</span>
          Exec_Master_Log_Pos: <span style="color: #008080;">4</span>
              Relay_Log_Space: <span style="color: #008080;">64337901</span>
              Until_Condition: None
               Until_Log_File:
                Until_Log_Pos: <span style="color: #008080;">0</span>
           Master_SSL_Allowed: <span style="color: #990099; font-weight: bold;">No</span>
           Master_SSL_CA_File:
           Master_SSL_CA_Path:
              Master_SSL_Cert:
            Master_SSL_Cipher:
               Master_SSL_Key:
        Seconds_Behind_Master: <span style="color: #9900FF; font-weight: bold;">NULL</span>
Master_SSL_Verify_Server_Cert: <span style="color: #990099; font-weight: bold;">No</span>
                Last_IO_Errno: <span style="color: #008080;">0</span>
                Last_IO_Error:
               Last_SQL_Errno: <span style="color: #008080;">1594</span>
               Last_SQL_Error: Relay <span style="color: #000099;">log</span> <span style="color: #990099; font-weight: bold;">read</span> failure: Could <span style="color: #CC0099; font-weight: bold;">not</span> parse relay <span style="color: #000099;">log</span> event entry. The possible reasons are: the master<span style="color: #008000;">'s binary log is corrupted (you can check this by running '</span>mysqlbinlog<span style="color: #008000;">' on the binary log), the slave'</span>s relay <span style="color: #000099;">log</span> <span style="color: #CC0099; font-weight: bold;">is</span> corrupted <span style="color: #FF00FF;">&#40;</span>you can <span style="color: #990099; font-weight: bold;">check</span> this by running <span style="color: #008000;">'mysqlbinlog'</span> <span style="color: #990099; font-weight: bold;">on</span> the relay <span style="color: #000099;">log</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span> a network problem<span style="color: #000033;">,</span> <span style="color: #CC0099; font-weight: bold;">or</span> a bug <span style="color: #990099; font-weight: bold;">in</span> the master<span style="color: #008000;">'s or slave'</span>s MySQL code. <span style="color: #009900;">If</span> you want <span style="color: #990099; font-weight: bold;">to</span> <span style="color: #990099; font-weight: bold;">check</span> the master<span style="color: #008000;">'s binary log or slave'</span>s relay <span style="color: #000099;">log</span><span style="color: #000033;">,</span> you will be able <span style="color: #990099; font-weight: bold;">to</span> know their names by issuing <span style="color: #008000;">'SHOW SLAVE STATUS'</span> <span style="color: #990099; font-weight: bold;">on</span> this slave.
<span style="color: #008080;">1</span> row <span style="color: #990099; font-weight: bold;">in</span> <span style="color: #990099; font-weight: bold;">set</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">0.00</span> sec<span style="color: #FF00FF;">&#41;</span>
 </pre></div></div>

<p>        从上面可以看到是中继日值或是Master上的日值出问题了。<br />
        首先如果是中继日值坏掉，那只需要找到同步的时间点，然后重新同步，这样就可以有新的中继日值了。如果Master上的日值坏了就麻烦了。<br />
从经验来看，这是中继日值出问题了。处理方法：</p>
<p>    需要找到同步的点。</p>
<p>日值为：Master_Log_File: mysql-bin.005121，Relay_Master_Log_File: mysql-bin.005121以Relay_Master_Log_File为准，Master_Log_File为参考。</p>
<p>日值执行时间点：</p>
<p>Exec_Master_Log_Pos: 4</p>
<p>那么现在就可以：</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;">  
      mysql<span style="color: #CC0099;">&gt;</span>stop slave<span style="color: #000033;">;</span>
&nbsp;
    mysql<span style="color: #CC0099;">&gt;</span>change master <span style="color: #990099; font-weight: bold;">to</span> Master_Log_File<span style="color: #CC0099;">=</span>’mysql<span style="color: #CC0099;">-</span><span style="color: #000099;">bin</span><span style="color: #008080;">.005121</span>’<span style="color: #000033;">,</span> Master_Log_Pos<span style="color: #CC0099;">=</span><span style="color: #008080;">4</span><span style="color: #000033;">;</span>
   
    mysql<span style="color: #CC0099;">&gt;</span>start slave<span style="color: #000033;">;</span>
&nbsp;
    mysql<span style="color: #CC0099;">&gt;</span>show slave <span style="color: #990099; font-weight: bold;">status</span>\G<span style="color: #000033;">;</span></pre></div></div>

<p>    进行确认。</p>
<p> </p>
<p><strong>   </strong><strong>建议：</strong></p>
<p>    在使用MySQL-5.1.36以下的版本的同学，请尽快升级到MySQL-5.1.40 &amp; MySQL-5.1.37sp1</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mysqlsupport.cn/relay-log-read-failure/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>mysql.user表怎么有两个root？密码怎么改？</title>
		<link>http://www.mysqlsupport.cn/mysql-user%e8%a1%a8%e6%80%8e%e4%b9%88%e6%9c%89%e4%b8%a4%e4%b8%aaroot%ef%bc%9f%e5%af%86%e7%a0%81%e6%80%8e%e4%b9%88%e6%94%b9%ef%bc%9f/</link>
		<comments>http://www.mysqlsupport.cn/mysql-user%e8%a1%a8%e6%80%8e%e4%b9%88%e6%9c%89%e4%b8%a4%e4%b8%aaroot%ef%bc%9f%e5%af%86%e7%a0%81%e6%80%8e%e4%b9%88%e6%94%b9%ef%bc%9f/#comments</comments>
		<pubDate>Thu, 14 May 2009 14:02:08 +0000</pubDate>
		<dc:creator>wubx</dc:creator>
				<category><![CDATA[MySQL TIPS/FAQ]]></category>
		<category><![CDATA[MySQL基础]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[<p><strong>作者：吴炳锡　来源：<a href="//">http://www.mysqlsupport.cn/</a> 联系方式：select unhex('777562696E67786940676D61696C2E636F6D'); 载请注明作/译者和出处，并且不能用于商业用途，违者必究。</strong><br /> MySQL的用户名有两部分组成： 用户名＠机器名<br /> <br /> 用户名：一般用字母组成。<br /> 机器名：可以是机器ＩＰ也可以机器名。机器名可以用dns也可以在/etc/hosts中声明。</p>
<p>所以可以称为不是两个root用户。</p>
<p>反应到user表中,用户名对应user，机器名对应于host,密码对应于password<br />一个用户名完整的标识为：user@host <br /> <br /> 更改密码：<br /> set  password for '用户名'@'主机名‘=password('yourpassword');<br /> <br /> 所以你见到的两个Ｒｏｏｔ不能算是一个用户名的。</p>
<p> </p>]]></description>
			<content:encoded><![CDATA[<p><strong>作者：吴炳锡　来源：<a href="//">http://www.mysqlsupport.cn/</a> 联系方式：select unhex(&#8217;777562696E67786940676D61696C2E636F6D&#8217;); 载请注明作/译者和出处，并且不能用于商业用途，违者必究。</strong><br />
MySQL的用户名有两部分组成： 用户名＠机器名</p>
<p>用户名：一般用字母组成。<br />
机器名：可以是机器ＩＰ也可以机器名。机器名可以用dns也可以在/etc/hosts中声明。</p>
<p>所以可以称为不是两个root用户。</p>
<p>反应到user表中,用户名对应user，机器名对应于host,密码对应于password<br />
一个用户名完整的标识为：user@host</p>
<p>更改密码：<br />
set  password for &#8216;用户名&#8217;@'主机名‘=password(&#8216;yourpassword&#8217;);</p>
<p>所以你见到的两个Ｒｏｏｔ不能算是一个用户名的。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mysqlsupport.cn/mysql-user%e8%a1%a8%e6%80%8e%e4%b9%88%e6%9c%89%e4%b8%a4%e4%b8%aaroot%ef%bc%9f%e5%af%86%e7%a0%81%e6%80%8e%e4%b9%88%e6%94%b9%ef%bc%9f/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL大表备份</title>
		<link>http://www.mysqlsupport.cn/mysql%e5%a4%a7%e8%a1%a8%e5%a4%87%e4%bb%bd/</link>
		<comments>http://www.mysqlsupport.cn/mysql%e5%a4%a7%e8%a1%a8%e5%a4%87%e4%bb%bd/#comments</comments>
		<pubDate>Fri, 08 May 2009 07:25:32 +0000</pubDate>
		<dc:creator>wubx</dc:creator>
				<category><![CDATA[MySQL基础]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[<p><strong>作者：吴炳锡　来源：<a href="/">http://www.mysqlsupport.cn/</a> 联系方式：select unhex('777562696E67786940676D61696C2E636F6D'); 载请注明作/译者和出处，并且不能用于商业用途，违者必究。</strong></p>
<p>      这里所说的大表是超地4G以上的表,我目前见到过最大为６０多Ｇ的单表，对于这种表每天一个全备可以说是一件很痛苦的事。<br />那么有没有办法，可以实现一个全备加增量的备份呢。<br />答案当然是有的。</p>
<p>在常规环境直可以用全备加binlog一同保存。<br />　　这种环境大多可以用一个Slave上进行备份操作。<br />　<strong>　思路：</strong><br /> 先停止Slave的同步，刷新buffer，对于Innodb 如果想直接拷贝还需要把innodb_max_dirty_pages_pct这个值置为零，然后在执行一次flush tables;<br /> 就可以cp了。如果是Dump出来可以这这样做。</p>]]></description>
			<content:encoded><![CDATA[<p><strong>作者：吴炳锡　来源：<a href="/">http://www.mysqlsupport.cn/</a> 联系方式：select unhex(&#8217;777562696E67786940676D61696C2E636F6D&#8217;); 载请注明作/译者和出处，并且不能用于商业用途，违者必究。</strong></p>
<p>      这里所说的大表是超地4G以上的表,我目前见到过最大为６０多Ｇ的单表，对于这种表每天一个全备可以说是一件很痛苦的事。<br />
那么有没有办法，可以实现一个全备加增量的备份呢。<br />
答案当然是有的。</p>
<p>在常规环境直可以用全备加binlog一同保存。<br />
　　这种环境大多可以用一个Slave上进行备份操作。<br />
　<strong>　思路：</strong><br />
 先停止Slave的同步，刷新buffer，对于Innodb 如果想直接拷贝还需要把innodb_max_dirty_pages_pct这个值置为零，然后在执行一次flush tables;<br />
 就可以cp了。如果是Dump出来可以这这样做。</p>
<p>      这个方案目前来看也是比较完美的，但一个并发力度大的应用一天的Binlog有可能能达到５０G－６０G，这样的系统开Binlog可以说是对系统的ＩＯ性能及整体性能都有早影响。</p>
<p>另一种方案就是基于表的上数据的罗辑变化进行备份。<br />
主体思想：全备加逻辑备份。<br />
逻辑备份：当有数据插入时，利用触发器同时写入另一个表，当数据更新时，我们同时记录一下，更新后的数据情况到另一个表。<br />
当有删除操作时，只需要记录一下，删除的主建ＩＤ就行。</p>
<p>例子：<br />
要备份的表：</p>
<pre class="plaintext_pre">CREATE TABLE `wubx` (  `id` int(11) NOT NULL auto_increment, </pre>
<pre class="plaintext_pre">`user_id` int(11) NOT NULL default '0', </pre>
<pre class="plaintext_pre"> `friend_id` int(11) NOT NULL default '0', </pre>
<pre class="plaintext_pre"> `dir_id` int(11) NOT NULL default '0', </pre>
<pre class="plaintext_pre"> `created` int(11) NOT NULL default '0', </pre>
<pre class="plaintext_pre"> UNIQUE KEY `id` (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;</pre>
<p>对于这个表我们需要建一个记录有新数据变化的表为：<br />
mysql&gt; create table wubx_ii like wubx;<br />
Query OK, 0 rows affected (0.00 sec)</p>
<p>mysql&gt; create table wubx_uu like wubx;<br />
Query OK, 0 rows affected (0.00 sec)<br />
mysql&gt; create table wubx_dd ( id int(11));<br />
Query OK, 0 rows affected (0.00 sec)</p>
<p>建立相应的触发程器</p>
<p>记录insert的操作：<br />
delimiter //<br />
create trigger wubx_ii after insert on wubx for each row begin insert into  wubx_ii set id=new.id,user_id=new.user_id,friend_id=new.friend_id,dir_id=new.dir_id,created=new.created; end//<br />
记录update的操作：<br />
create trigger wubx_uu after update on wubx for each row begin replace into  wubx_uu set id=new.id,user_id=new.user_id,friend_id=new.friend_id,dir_id=new.dir_id,created=new.created; end//<br />
记录删除的操作：<br />
create trigger wubx_dd after delete on wubx for each row begin insert into wubx_dd values(old.id); end//</p>
<p>delimiter ;</p>
<p>操作：<br />
先备份原始表wubx里的数据：<br />
进行：<br />
insert into wubx values(”,1,10,1,1198464252);<br />
insert into wubx values(”,1,11,1,1198464252);<br />
insert into wubx values(”,1,2,1,1198464252);<br />
insert into wubx values(”,2,10,1,1198464252);<br />
insert into wubx values(”,2,12,1,1198464252);<br />
insert into wubx values(”,3,12,1,1198464252);<br />
update wubx set dir_id=5 where user_id=3;<br />
update wubx set dir_id=4 where user_id=3;<br />
delete from wubx where user_id=2 and friend_id=12;<br />
现在要实现增量备份：<br />
取出insert的操作：<br />
mysql -e ” select concat(&#8216;replace into wubx set id=&#8217;,id,&#8217;,user_id=&#8217;,user_id,&#8217;,friend_id=&#8217;,friend_id,&#8217;,dir_id=&#8217;,dir_id,&#8217;,created=&#8217;,created,&#8217;;') from wubx_ii;”&gt;&gt;backup_ii.sql</p>
<p>取出update的操作：<br />
mysql -e ” select concat(&#8216;update wubx set user_id=&#8217;,user_id,&#8217;,friend_id=&#8217;,friend_id,&#8217;,dir_id=&#8217;,dir_id,&#8217;,created=&#8217;,created,&#8217; where id=&#8217;,id,&#8217;;') from wubx_uu;”&gt;&gt;backup_uu.sql</p>
<p>取出delete的操作：<br />
mysql -e “select concat(&#8216;delete from wubx where id=&#8217;,id,&#8217;;') from wubx_dd”&gt;&gt;backup_dd.sql</p>
<p>这样利用这些逻辑的备份加是完毕备份恢复到当前恢复点就很容易了。这里不演示。</p>
<p>这个操作最好用一个程序完成，当取完罗辑备份后，做一个标记点去清楚备份完的数据，以保证，逻辑记录表里的数据量比较少是正确的。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mysqlsupport.cn/mysql%e5%a4%a7%e8%a1%a8%e5%a4%87%e4%bb%bd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>注意：MySQL用户密码中的“！”</title>
		<link>http://www.mysqlsupport.cn/%e6%b3%a8%e6%84%8f%ef%bc%9amysql%e7%94%a8%e6%88%b7%e5%af%86%e7%a0%81%e4%b8%ad%e7%9a%84%e2%80%9c%ef%bc%81%e2%80%9d/</link>
		<comments>http://www.mysqlsupport.cn/%e6%b3%a8%e6%84%8f%ef%bc%9amysql%e7%94%a8%e6%88%b7%e5%af%86%e7%a0%81%e4%b8%ad%e7%9a%84%e2%80%9c%ef%bc%81%e2%80%9d/#comments</comments>
		<pubDate>Wed, 06 May 2009 08:11:15 +0000</pubDate>
		<dc:creator>wubx</dc:creator>
				<category><![CDATA[MySQL TIPS/FAQ]]></category>
		<category><![CDATA[MySQL基础]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[<h3 class="post-title entry-title"></h3>
<div class="post-header-line-1"></div>
<div class="post-body entry-content"><strong>作者：吴炳锡　来源：<a href="http://www.mysqlsupport.cn/">http://www.mysqlsupport.cn/</a> 联系方式： wubingxi#gmail.com 转载请注明作/译者和出处，并且不能用于商业用途，违者必究。</strong><br /><br /><strong>Tips</strong><br />　　禁止用户终端进入的一个方法。<br /><br />mysql&#62; <span style="color: #009900;">grant all privileges on wubx.* to </span><a href="mailto:"><span style="color: #009900;">'wubx'@'172.16.100.185'</span></a><span style="color: #009900;"> identified by 'fd52!wubx＆,';</span>]]></description>
			<content:encoded><![CDATA[<div class="post-body entry-content"><strong>作者：吴炳锡　来源：<a href="http://www.mysqlsupport.cn/">http://www.mysqlsupport.cn/</a> 联系方式： wubingxi#gmail.com 转载请注明作/译者和出处，并且不能用于商业用途，违者必究。</strong></div>
<p><strong>Tips</strong><br />
　　禁止用户终端进入的一个方法。</p>
<p>mysql&gt; <span style="color: #009900;">grant all privileges on wubx.* to </span><a href="mailto:"><span style="color: #009900;">&#8216;wubx&#8217;@&#8217;172.16.100.185&#8242;</span></a><span style="color: #009900;"> identified by &#8216;fd52!wubx＆,&#8217;;</span><br />
Query OK, 0 rows affected (0.00 sec)<br />
mysql&gt;<span style="color: #006600;">quit;</span><br />
<span style="color: #006600;">#mysql -h 172.16.100.185 -u wubx -pfd52!wubx＆,</span><br />
-bash: !wubx@,: event not found</p>
<p>仔细看一下，原来他把！后面的字符串做为命令执行了。又试了一个Navicat的管理端，也一样存在密码不正常的问题。<br />
在测一下程序方面是不是可以用，写一个ＰＨＰ测一下。<br />
<span style="color: #009900;"><!--p</sp--><br />
<span style="color: #009900;">$link = mysql_connect(&#8217;172.16.100.185&#8242;,&#8217;wubx&#8217;,'fd52!wubx＆,&#8217;);</span><br />
<span style="color: #009900;">if (!link){ </span><br />
<span style="color: #009900;">die(&#8216;Could not connect:&#8217;.mysql_error());</span><br />
<span style="color: #009900;">}</span><br />
<span style="color: #009900;">echo &#8216;Connected successfully&#8217;;mysql_close($link);</span><br />
<span style="color: #009900;">?&gt;<br />
</span>#<span style="color: #009900;">php testdb.php</span><br />
Connected successfully<br />
还看程序中能正常识别。<br />
PHP还是可以ＯＫ通过的。<br />
</span><span style="color: #009900;"> </span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mysqlsupport.cn/%e6%b3%a8%e6%84%8f%ef%bc%9amysql%e7%94%a8%e6%88%b7%e5%af%86%e7%a0%81%e4%b8%ad%e7%9a%84%e2%80%9c%ef%bc%81%e2%80%9d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>分享：我下载Mysql的地方</title>
		<link>http://www.mysqlsupport.cn/%e5%88%86%e4%ba%ab%ef%bc%9a%e6%88%91%e4%b8%8b%e8%bd%bdmysql%e7%9a%84%e5%9c%b0%e6%96%b9/</link>
		<comments>http://www.mysqlsupport.cn/%e5%88%86%e4%ba%ab%ef%bc%9a%e6%88%91%e4%b8%8b%e8%bd%bdmysql%e7%9a%84%e5%9c%b0%e6%96%b9/#comments</comments>
		<pubDate>Wed, 06 May 2009 08:09:38 +0000</pubDate>
		<dc:creator>wubx</dc:creator>
				<category><![CDATA[MySQL基础]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[<h3 class="post-title entry-title"></h3>
<div class="post-header-line-1"></div>
<div class="post-body entry-content">作者：吴炳锡　来源：http://www.mysqlsupport.cn/ 联系方式： wubingxi#gmail.com 转载请注明作/译者和出处，并且不能用于商业用途，违者必究。<br /><br />第一个：<br />http://mirror.provenscaling.com/<br /><br />特点：<br />有社区版和企业版两种，基本上比较全。上面的每个版本基本都没问题。<br /><br />第二个：<br /><br />http://www.percona.com/mysql/<br /><br />特点：<br />国际Mysql牛人Peter(仅次于国内牛人叶大师yejr)的公司研究的分支及官方的代码patch都能找到的地方。<br /><br />第三个：<br /><br />http://www.mysql.com<br /><br />特点：<br />Mysql的官方网站。不用多说了。<br /><br />第四个：<br />]]></description>
			<content:encoded><![CDATA[<div class="post-body entry-content">作者：吴炳锡　来源：http://www.mysqlsupport.cn/ 联系方式： wubingxi#gmail.com 转载请注明作/译者和出处，并且不能用于商业用途，违者必究。</div>
<p>第一个：</p>
<p>http://mirror.provenscaling.com/</p>
<p>特点：<br />
有社区版和企业版两种，基本上比较全。上面的每个版本基本都没问题。</p>
<p>第二个：</p>
<p>http://www.percona.com/mysql/</p>
<p>特点：<br />
国际Mysql牛人Peter(仅次于国内牛人叶大师yejr)的公司研究的分支及官方的代码patch都能找到的地方。</p>
<p>第三个：</p>
<p>http://www.mysql.com</p>
<p>特点：<br />
Mysql的官方网站。不用多说了。</p>
<p>第四个：</p>
<p>http://code.google.com/p/google-mysql-tools/</p>
<p>特点：</p>
<p>Google的东西，绝对货真假实。</p>
<p>===============================================</p>
<p>最后在推一个学习Mysql的最佳Blog（对中国Mysqler来说的）</p>
<p>http://imysql.cn</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mysqlsupport.cn/%e5%88%86%e4%ba%ab%ef%bc%9a%e6%88%91%e4%b8%8b%e8%bd%bdmysql%e7%9a%84%e5%9c%b0%e6%96%b9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>大量unauthenticated user出现</title>
		<link>http://www.mysqlsupport.cn/unauthenticated-user/</link>
		<comments>http://www.mysqlsupport.cn/unauthenticated-user/#comments</comments>
		<pubDate>Wed, 06 May 2009 08:08:13 +0000</pubDate>
		<dc:creator>wubx</dc:creator>
				<category><![CDATA[MySQL TIPS/FAQ]]></category>
		<category><![CDATA[MySQL基础]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[<h3 class="post-title entry-title"></h3>
<div class="post-header-line-1"></div>
<div class="post-body entry-content">作者：吴炳锡　来源：http://www.mysqlsupport.cn/ 联系方式： wubingxi#gmail.com 转载请注明作/译者和出处，并且不能用于商业用途，违者必究。<br /><br />首先查出来有那些ＩＰ连接mysql<br /><span style="color: #009900;">mysql -e "show processlist"&#124;awk '{print $3}'&#124;sed -e 's/:.*$//' &#124;sort &#124;uniq -c</span><br /><br />记录一下这些ＩＰ<br /><br />再收次一下那些ＩＰ出现　unauthenticated user<br /><span style="color: #009900;">mysql -e "show processlist"&#124;sed -s "/unauthenticated/"&#124;awk '{print $3}'&#124;sed -e 's/:.*$//' &#124;sort &#124;uniq -c</span><br /><br />多次执行，比较结果。]]></description>
			<content:encoded><![CDATA[<div class="post-body entry-content">作者：吴炳锡　来源：http://www.mysqlsupport.cn/ 联系方式： wubingxi#gmail.com 转载请注明作/译者和出处，并且不能用于商业用途，违者必究。</div>
<p>首先查出来有那些ＩＰ连接mysql<br />
<span style="color: #009900;">mysql -e “show processlist”|awk &#8216;{print $3}&#8217;|sed -e &#8216;s/:.*$//&#8217; |sort |uniq -c</span></p>
<p>记录一下这些ＩＰ</p>
<p>再收次一下那些ＩＰ出现　unauthenticated user<br />
<span style="color: #009900;">mysql -e “show processlist”|sed -s “/unauthenticated/”|awk &#8216;{print $3}&#8217;|sed -e &#8216;s/:.*$//&#8217; |sort |uniq -c</span></p>
<p>多次执行，比较结果。<br />
最终在/etc/hosts 里添加相应的ＩＰ及对应的名称。</p>
<p>参考建义(来自ＣＵ)：<br />
1、skip-name-resolve 已经添加之后； 最好在改用IP连接。<br />
2、max_allowed_packet 参数可以适当调整。<br />
3、MySQL 客户端库文件版本太低也有可能出现这个问题。<br />
4、如php、java等应用端服务压力大，线程异常中断也会导致连接MySQL异常断开。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mysqlsupport.cn/unauthenticated-user/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

