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

<channel>
	<title>稀饭的国度 &#187; mysql</title>
	<atom:link href="http://blog.thematice.com/html/ytag/mysql/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.thematice.com</link>
	<description>发现自己的脑袋不好使了，用blog来记录真的很好用。</description>
	<lastBuildDate>Wed, 01 Feb 2012 05:33:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>MySQL也有潜规则 &#8211; Select 语句不加 Order By 如何排序？</title>
		<link>http://blog.thematice.com/html/y2010/04/26/1085/mysql%e4%b9%9f%e6%9c%89%e6%bd%9c%e8%a7%84%e5%88%99-select-%e8%af%ad%e5%8f%a5%e4%b8%8d%e5%8a%a0-order-by-%e5%a6%82%e4%bd%95%e6%8e%92%e5%ba%8f%ef%bc%9f.html#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql%25e4%25b9%259f%25e6%259c%2589%25e6%25bd%259c%25e8%25a7%2584%25e5%2588%2599-select-%25e8%25af%25ad%25e5%258f%25a5%25e4%25b8%258d%25e5%258a%25a0-order-by-%25e5%25a6%2582%25e4%25bd%2595%25e6%258e%2592%25e5%25ba%258f%25ef%25bc%259f</link>
		<comments>http://blog.thematice.com/html/y2010/04/26/1085/mysql%e4%b9%9f%e6%9c%89%e6%bd%9c%e8%a7%84%e5%88%99-select-%e8%af%ad%e5%8f%a5%e4%b8%8d%e5%8a%a0-order-by-%e5%a6%82%e4%bd%95%e6%8e%92%e5%ba%8f%ef%bc%9f.html#comments</comments>
		<pubDate>Mon, 26 Apr 2010 07:00:41 +0000</pubDate>
		<dc:creator>稀饭</dc:creator>
				<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://blog.thematice.com/?p=1085</guid>
		<description><![CDATA[今天遇到一个问题，有一个 Select 语句没有加 “Order By”，返回的数据是不确定的。 这种问题碰到不止几次了。追根寻底， Select 语句如果不加 “Order By”， MySQL会怎么排序呢？ 在网上搜了一下，在MySQL论坛发现了这篇文章。 http://forums.mysql.com/read.php?21,239471,239688#msg-239688 简单翻译一下 * 不能依赖 MySQL 的默认排序 * 如果你想排序，总是加上 Order By * GROUP BY 强加了 Order By （这与标准语法冲突，如果要避免，请使用 ORDER BY NULL）这里我有疑问， 到底强加了何种 Order by 对于 MyISAM 表 MySQL Select 默认排序是按照物理存储顺序显示的。（不进行额外排序）. 也就是说 SELECT * FROM tbl &#8211; 会产生“表扫描”。如果表没有删除、替换、更新操作，记录会显示为插入的顺序。 InnoDB 表 同样的情况，会按主键的顺序排列。再次强调，这只是潜规则（artifact of the underlying implementation：怎么翻译？）， [...]]]></description>
		<wfw:commentRss>http://blog.thematice.com/html/y2010/04/26/1085/mysql%e4%b9%9f%e6%9c%89%e6%bd%9c%e8%a7%84%e5%88%99-select-%e8%af%ad%e5%8f%a5%e4%b8%8d%e5%8a%a0-order-by-%e5%a6%82%e4%bd%95%e6%8e%92%e5%ba%8f%ef%bc%9f.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XtraDB storage engine release 1.0.6-9</title>
		<link>http://blog.thematice.com/html/y2010/02/23/1040/xtradb-storage-engine-release-1-0-6-9.html#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=xtradb-storage-engine-release-1-0-6-9</link>
		<comments>http://blog.thematice.com/html/y2010/02/23/1040/xtradb-storage-engine-release-1-0-6-9.html#comments</comments>
		<pubDate>Tue, 23 Feb 2010 02:21:36 +0000</pubDate>
		<dc:creator>稀饭</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[DataBase]]></category>
		<category><![CDATA[XtraDB]]></category>

		<guid isPermaLink="false">http://blog.thematice.com/?p=1040</guid>
		<description><![CDATA[Dear Community, As of today Release 9 of XtraDB storage engine is available. The release includes following new features: The release is base on 1.0.6 version of InnoDB plugin. MySQL 5.1.42 as a base release Separate purge thread and LRU dump is implemented (this feature was actually added in Release 8, but somehow it was [...]]]></description>
		<wfw:commentRss>http://blog.thematice.com/html/y2010/02/23/1040/xtradb-storage-engine-release-1-0-6-9.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MyISAM和InnoDB的插入性能测试</title>
		<link>http://blog.thematice.com/html/y2010/02/23/1032/myisam%e5%92%8cinnodb%e7%9a%84%e6%8f%92%e5%85%a5%e6%80%a7%e8%83%bd%e6%b5%8b%e8%af%95.html#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=myisam%25e5%2592%258cinnodb%25e7%259a%2584%25e6%258f%2592%25e5%2585%25a5%25e6%2580%25a7%25e8%2583%25bd%25e6%25b5%258b%25e8%25af%2595</link>
		<comments>http://blog.thematice.com/html/y2010/02/23/1032/myisam%e5%92%8cinnodb%e7%9a%84%e6%8f%92%e5%85%a5%e6%80%a7%e8%83%bd%e6%b5%8b%e8%af%95.html#comments</comments>
		<pubDate>Tue, 23 Feb 2010 02:09:16 +0000</pubDate>
		<dc:creator>稀饭</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[压力]]></category>
		<category><![CDATA[测试]]></category>

		<guid isPermaLink="false">http://blog.thematice.com/?p=1032</guid>
		<description><![CDATA[测试表结构： CREATE TABLE `test` ( `ID` bigint(20) NOT NULL auto_increment, `INT_A` int(11) default NULL, `INT_B` int(11) default NULL, `INT_C` int(11) default NULL, `STRING_A` varchar(50) default NULL, `STRING_B` varchar(250) default NULL, `STRING_C` varchar(700) default NULL, PRIMARY KEY (`ID`), KEY `IDX_TEST_IA` (`INT_A`), KEY `IDX_TEST_IB` (`INT_B`), KEY `IDX_TEST_SA` (`STRING_A`,`INT_C`) ) ; 数据量：总共10个表，每个表插入400w数据 并发数：每个表并发20个线程去执行插入操作，总共200个线程 数据特点：除了主键采用自增外，索引相关字段全是随机生成的。字符串的长度和内容都是随机的，平均长度为预定义的一半 X轴是unix时间戳，Y轴是十秒钟的插入量。从以上测试结果可以看出，InnoDB的插入性能随着数据量的增多一直在下降，而且表现相当不稳定。MyISAM的表现还是比较好的，虽然瞬时插入的谷值一直在下降，但是整体表现很稳定。 总的来说，Ext3的cache算法性能还是非常不错的，不愧是linux上面备受推崇的文件系统。InnoDB虽然提供了高可用性，但是插入性能方面的表现并不如MyISAM稳定。 Tags: benchmark, [...]]]></description>
		<wfw:commentRss>http://blog.thematice.com/html/y2010/02/23/1032/myisam%e5%92%8cinnodb%e7%9a%84%e6%8f%92%e5%85%a5%e6%80%a7%e8%83%bd%e6%b5%8b%e8%af%95.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>备忘,mysql的filesort</title>
		<link>http://blog.thematice.com/html/y2009/09/21/710/%e5%a4%87%e5%bf%98mysql%e7%9a%84filesort.html#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=%25e5%25a4%2587%25e5%25bf%2598mysql%25e7%259a%2584filesort</link>
		<comments>http://blog.thematice.com/html/y2009/09/21/710/%e5%a4%87%e5%bf%98mysql%e7%9a%84filesort.html#comments</comments>
		<pubDate>Mon, 21 Sep 2009 03:21:40 +0000</pubDate>
		<dc:creator>稀饭</dc:creator>
				<category><![CDATA[databases]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[explain]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://blog.thematice.com/?p=710</guid>
		<description><![CDATA[恩,又一个知识忘记了..看来要常做备忘才行… explain 显示的filesort不是说”因为数据太大,内存不够,然后在文件中排序”..filesort的意思是”排序没有使用到索引“,跟文件(file)没啥关系.. 当然了,sort这个不会是错的,算法是用quicksort,也就是快速排序]]></description>
		<wfw:commentRss>http://blog.thematice.com/html/y2009/09/21/710/%e5%a4%87%e5%bf%98mysql%e7%9a%84filesort.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>{原创}nginx错误排查不断更新ing</title>
		<link>http://blog.thematice.com/html/y2009/05/27/506/nginx-debug-updating.html#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nginx-debug-updating</link>
		<comments>http://blog.thematice.com/html/y2009/05/27/506/nginx-debug-updating.html#comments</comments>
		<pubDate>Wed, 27 May 2009 07:34:45 +0000</pubDate>
		<dc:creator>稀饭</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux  web]]></category>
		<category><![CDATA[Linux net]]></category>
		<category><![CDATA[linux shell]]></category>
		<category><![CDATA[Linux tools]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[gcc4]]></category>
		<category><![CDATA[glib]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[x86]]></category>

		<guid isPermaLink="false">http://blog.thematice.com/?p=506</guid>
		<description><![CDATA[DEBUG NO01: 背景: 服务器环境: nginx 0.7.52 php 5.2.8 mysql 5.1.32 gcc gcc4 linux X86 用户时常会反应无法登入我们的服务器. ie提示错误:用户提交post请求以后.ie直接提示无法dns无法解析.使用httpdwatech抓包分析得到.原来是服务器没有返回流量器post的请求. chrome提示错误: 此网页无法访问。http://passport.hoopchina.com/login.php 的网页可能暂时无法连接，或者它已被永久性地移动到新网址。 有关此错误的更多信息以下是原始错误消息 错误 320 (net::ERR_INVALID_RESPONSE): 未知错误。 分析判断不是dns服务器解析的问题. 登入系统查看系统nginx的log和dmesg信息.发现问题所在.. ?Download nginx_error.log1 2 3 4 5 6 7 8 9 10 11 &#91;root@Web01 $path_root&#93;# tailf /$path_root/logs/nginx_error.log 2009/05/27 14:33:40 &#91;alert&#93; 10128#0: worker process 10656 exited on signal 11 2009/05/27 14:34:03 [...]]]></description>
		<wfw:commentRss>http://blog.thematice.com/html/y2009/05/27/506/nginx-debug-updating.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>MySQL配置文件my.cnf 例子最详细翻译,可以保存做笔记用。</title>
		<link>http://blog.thematice.com/html/y2009/05/26/499/mysql-configuration-file-mycnf-examples-of-the-most-detailed-translation-notes-can-be-saved-with.html#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-configuration-file-mycnf-examples-of-the-most-detailed-translation-notes-can-be-saved-with</link>
		<comments>http://blog.thematice.com/html/y2009/05/26/499/mysql-configuration-file-mycnf-examples-of-the-most-detailed-translation-notes-can-be-saved-with.html#comments</comments>
		<pubDate>Tue, 26 May 2009 11:18:36 +0000</pubDate>
		<dc:creator>稀饭</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[configure]]></category>
		<category><![CDATA[dba]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[my.cnf]]></category>

		<guid isPermaLink="false">http://blog.thematice.com/?p=499</guid>
		<description><![CDATA[MySQL配置文件my.cnf 例子最详细翻译,可以保存做笔记用。 ?Download my.cnf1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 [...]]]></description>
		<wfw:commentRss>http://blog.thematice.com/html/y2009/05/26/499/mysql-configuration-file-mycnf-examples-of-the-most-detailed-translation-notes-can-be-saved-with.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MYSQL优化之优化参数thread_cache_size</title>
		<link>http://blog.thematice.com/html/y2008/03/10/72/mysql-optimization-of-parameters-to-optimize-thread_cache_size.html#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-optimization-of-parameters-to-optimize-thread_cache_size</link>
		<comments>http://blog.thematice.com/html/y2008/03/10/72/mysql-optimization-of-parameters-to-optimize-thread_cache_size.html#comments</comments>
		<pubDate>Mon, 10 Mar 2008 11:10:06 +0000</pubDate>
		<dc:creator>稀饭</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[thread_cache_size]]></category>

		<guid isPermaLink="false">http://www.gruelstate.cn/?p=72</guid>
		<description><![CDATA[http://ceo.xwschool.net/blog/blog?do-showone-tid-176.html 以下是某门户网站的mysql状态实例及分析过程，绝对的第一手数据资料，很生动的体现了参数thread_cache_size优化的效果及优化该参数的必要性，希望对各位系统管理员能有帮助。 说明： 根据调查发现以上服务器线程缓存thread_cache_size没有进行设置，或者设置过小,这个值表示可以重新利用保存在缓存中线程的数量,当断开 连接时如果缓存中还有空间,那么客户端的线程将被放到缓存中,如果线程重新被请求，那么请求将从缓存中读取,如果缓存中是空的或者是新的请求，那么这个线 程将被重新创建,如果有很多新的线程，增加这个值可以改善系统性能.通过比较 Connections 和 Threads_created 状态的变量，可以看到这个变量的作用。(&#8211;&#62;表示要调整的值)   根据物理内存设置规则如下： 1G  &#8212;&#62; 8 2G  &#8212;&#62; 16 3G  &#8212;&#62; 32 &#62;3G  &#8212;&#62; 64 Mysql参数thread_cache_size状态表及优化调整]]></description>
		<wfw:commentRss>http://blog.thematice.com/html/y2008/03/10/72/mysql-optimization-of-parameters-to-optimize-thread_cache_size.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[转载]装MYSQL时遇到的错误归档（随时更新）</title>
		<link>http://blog.thematice.com/html/y2008/03/08/69/reprint-installed-mysql-error-when-archiving-update.html#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=reprint-installed-mysql-error-when-archiving-update</link>
		<comments>http://blog.thematice.com/html/y2008/03/08/69/reprint-installed-mysql-error-when-archiving-update.html#comments</comments>
		<pubDate>Sat, 08 Mar 2008 12:21:28 +0000</pubDate>
		<dc:creator>稀饭</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[my.cnf]]></category>
		<category><![CDATA[system]]></category>

		<guid isPermaLink="false">http://www.gruelstate.cn/?p=69</guid>
		<description><![CDATA[[转载]http://blog.chinaunix.net/u/29134/showart_432764.html  今天我升级MYSQL到5.1的时候遇到的。写出来共享以下。1、 [root@localhost mysql]# scripts/mysql_install_db Neither host &#8216;localhost.localdomain&#8217; nor &#8216;localhost&#8217; could be looked up with/resolveipPlease configure the &#8216;hostname&#8217; command to return a correcthostname.If you want to solve this at a later stage, restart this scriptwith the &#8211;force option 这个主要是修改/etc/hosts文件echo “127.0.0.1 localhost.localdomain localhost” &#62;&#62; /etc/hosts然后再初始化数据，如果还是同样的错误，那就直接加&#8211;force开关。我今天碰到的就是这个情况。 [root@localhost mysql]# scripts/mysql_install_db &#8211;force Installing MySQL system tables&#8230; OK Filling help [...]]]></description>
		<wfw:commentRss>http://blog.thematice.com/html/y2008/03/08/69/reprint-installed-mysql-error-when-archiving-update.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysql-Got a packet bigger than ‘max_allowed_packet’ bytes</title>
		<link>http://blog.thematice.com/html/y2008/03/06/68/mysql-got-a-packet-bigger-than-%e2%80%98max_allowed_packet%e2%80%99-bytes.html#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-got-a-packet-bigger-than-%25e2%2580%2598max_allowed_packet%25e2%2580%2599-bytes</link>
		<comments>http://blog.thematice.com/html/y2008/03/06/68/mysql-got-a-packet-bigger-than-%e2%80%98max_allowed_packet%e2%80%99-bytes.html#comments</comments>
		<pubDate>Thu, 06 Mar 2008 14:43:07 +0000</pubDate>
		<dc:creator>稀饭</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mysql DBA]]></category>
		<category><![CDATA[mysqlbilog]]></category>

		<guid isPermaLink="false">http://www.gruelstate.cn/?p=68</guid>
		<description><![CDATA[今天对数据库分表维护的时候出现这样一个问题 Got a packet bigger than ‘max_allowed_packet’ bytes 问题出在没有调整mysql的配置文件,于是调整/etc/my.cnf 修改mysql的最大允许包大小 在[mysqld]部分(不在这部分没用)添加一句： max_allowed_packet=10485760 重启mysql服务就可以了，这里设置的是10MB。]]></description>
		<wfw:commentRss>http://blog.thematice.com/html/y2008/03/06/68/mysql-got-a-packet-bigger-than-%e2%80%98max_allowed_packet%e2%80%99-bytes.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysql4.1以上版本连接时出现Client does not support authentication protocol问题解决办法</title>
		<link>http://blog.thematice.com/html/y2008/02/29/65/above-mysql41-when-connecting-client-does-not-support-authentication-protocol-solution-to-the-problems.html#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=above-mysql41-when-connecting-client-does-not-support-authentication-protocol-solution-to-the-problems</link>
		<comments>http://blog.thematice.com/html/y2008/02/29/65/above-mysql41-when-connecting-client-does-not-support-authentication-protocol-solution-to-the-problems.html#comments</comments>
		<pubDate>Fri, 29 Feb 2008 10:02:34 +0000</pubDate>
		<dc:creator>稀饭</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[my.cnf]]></category>
		<category><![CDATA[system]]></category>

		<guid isPermaLink="false">http://www.gruelstate.cn/?p=65</guid>
		<description><![CDATA[shell&#62; mysql Client does not support authentication protocol requested by server; consider upgrading MySQL client 官方的说法是 MySQL 4.1 and up uses an authentication protocol based on a password hashing algorithm that is incompatible with that used by older clients. &#8230;.. 如果你升级mysql到4.1以上版本后遇到以上问题,请先确定你的mysql client 是4.1或者更高版本.(WINDOWS下有问题你就直接跳到下面看解决方法了,因为MYSQL 在WINDOWS是client和server一起装上了的) 请使用以下两种方法之一 其一: mysql&#62; SET PASSWORD FOR -&#62; &#8216;some_user&#8217;@'some_host&#8217; = OLD_PASSWORD(&#8216;newpwd&#8217;); 其二: [...]]]></description>
		<wfw:commentRss>http://blog.thematice.com/html/y2008/02/29/65/above-mysql41-when-connecting-client-does-not-support-authentication-protocol-solution-to-the-problems.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>64位与32位 Linux下MySQL性能比较(转)</title>
		<link>http://blog.thematice.com/html/y2008/02/14/52/64-bit-and-32-bit-linux-performance-comparison-of-mysql-to.html#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=64-bit-and-32-bit-linux-performance-comparison-of-mysql-to</link>
		<comments>http://blog.thematice.com/html/y2008/02/14/52/64-bit-and-32-bit-linux-performance-comparison-of-mysql-to.html#comments</comments>
		<pubDate>Thu, 14 Feb 2008 02:18:06 +0000</pubDate>
		<dc:creator>稀饭</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[my.cnf]]></category>
		<category><![CDATA[system]]></category>

		<guid isPermaLink="false">http://www.gruelstate.cn/?p=52</guid>
		<description><![CDATA[64位与32位 Linux下MySQL性能比较(转) 原帖 http://www.wordyou.com/archives/56 阅读了http://www.anandtech.com/IT/showdoc.aspx?i=2447&#38;p=5的优秀测试，大致得出以下结论： 1. 同主频Xeon下64位性能反而不如32位，Opteron下64bit性能提高大约30％左右，此测试可能与编译器优化有关。 2. 双核比双cpu单核比较性能大约提高6％ 3. 超线程开启性能下降10％左右(MySQL read) 4. InnoDB性能大约是MyISAM的60％，但对于多cpu（核心）扩展性比MyISAM强很多 5. 同主频AMD的Opteron性能比Intel的Xeon高13％左右 6. 不论MyISAM还是InnoDB，4核心(俩双核cpu）比单双核cpu性能仅提高10％ 如果采用xeon服务器，关闭超线程并采用32位系统性能最佳 如果采用opteron，64bit可以获得最佳性能，而单双核cpu就足够理想，四核心对性能提高并不明显。]]></description>
		<wfw:commentRss>http://blog.thematice.com/html/y2008/02/14/52/64-bit-and-32-bit-linux-performance-comparison-of-mysql-to.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>mysql-proxy安装过程 (转)</title>
		<link>http://blog.thematice.com/html/y2008/02/13/51/mysql-proxy-installation-process-to.html#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-proxy-installation-process-to</link>
		<comments>http://blog.thematice.com/html/y2008/02/13/51/mysql-proxy-installation-process-to.html#comments</comments>
		<pubDate>Wed, 13 Feb 2008 10:24:00 +0000</pubDate>
		<dc:creator>稀饭</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql-proxy]]></category>

		<guid isPermaLink="false">http://www.gruelstate.cn/?p=51</guid>
		<description><![CDATA[mysql-proxy是好东西，在使用cluster不方便的时候，采用mysql-proxy作为slave机器的中间服务器，能够有效简化程序编写，同时能够做到简单的负载均衡，我想对于一个简单的应用是足够了。 我的操作系统的linux AS4U4 ,装了开发包。 首先要安装glib和 lua ,值得一提的是lua 的配置方式，提供了极大的灵活性，这个方式值得我们学习。 安装过程如下： tar -xvf glib-2.8.6.tar cd glib-2.8.6 ./configure &#8211;prefix=/usr make;make install tar -xvzf lua-5.1.2.tar.gz cd lua-5.1.2 make linux install INSTALL_TOP=/usr/ tar -xvzf mysql-proxy-0.5.1.tar.gz cd mysql-proxy-0.5.1 LUA_CFLAGS=”-I/usr/include” LUA_LIBS=”-L/usr/lib -llua -lm -ldl” ./configure make make install 安装完毕后，可以写一个启动服务器脚本，在手册上有。在线帮助也有，这里我就不贴了，目前使用半年了，一直没有什么问题。 如果能和memcache结合起来，那就更好了，比mysql一直在鼓吹的mysql内存cache还要好。]]></description>
		<wfw:commentRss>http://blog.thematice.com/html/y2008/02/13/51/mysql-proxy-installation-process-to.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysql 4.1以上版本中文乱码解决方法集锦</title>
		<link>http://blog.thematice.com/html/y2007/12/03/42/mysql-41%e4%bb%a5%e4%b8%8a%e7%89%88%e6%9c%ac%e4%b8%ad%e6%96%87%e4%b9%b1%e7%a0%81%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95%e9%9b%86%e9%94%a6.html#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-41%25e4%25bb%25a5%25e4%25b8%258a%25e7%2589%2588%25e6%259c%25ac%25e4%25b8%25ad%25e6%2596%2587%25e4%25b9%25b1%25e7%25a0%2581%25e8%25a7%25a3%25e5%2586%25b3%25e6%2596%25b9%25e6%25b3%2595%25e9%259b%2586%25e9%2594%25a6</link>
		<comments>http://blog.thematice.com/html/y2007/12/03/42/mysql-41%e4%bb%a5%e4%b8%8a%e7%89%88%e6%9c%ac%e4%b8%ad%e6%96%87%e4%b9%b1%e7%a0%81%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95%e9%9b%86%e9%94%a6.html#comments</comments>
		<pubDate>Mon, 03 Dec 2007 09:12:01 +0000</pubDate>
		<dc:creator>稀饭</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[乱码]]></category>

		<guid isPermaLink="false">http://www.gruelstate.cn/index.php/2007/12/03/mysql-41%e4%bb%a5%e4%b8%8a%e7%89%88%e6%9c%ac%e4%b8%ad%e6%96%87%e4%b9%b1%e7%a0%81%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95%e9%9b%86%e9%94%a6/</guid>
		<description><![CDATA[mysql 4.1的改变造成的乱码解决方法 第一个方法： MySQL 4.1 中文乱码的问题 最近要将 MySQL 4.0 升级到 MySQL 4.1 ，发现了中文乱码的问题，希望以下见解对大家有用。 1. MySQL 4.1 在文字上有很大改进，它有了 Character Set 与 Collation 的慨念。 2. 在 MySQL 4.0 ，一般的程式都会将文字以拉丁文 ( latin)  来储存，就算我们输入中文字，结果仍是放在以拉丁文设置的文字栏里头，这对 MySQL 4.0 与以 MySQL 4.0 为基楚的程式来说，并不会有问题。 3. 可是 MySQL 4.1 的系统编码是预设用 UTF-8 的，当要 restore MySQL 4.0 的 backup 档到 MySQL 4.1 时，乱码就出现了。原因在于 MySQL 4.1 将 [...]]]></description>
		<wfw:commentRss>http://blog.thematice.com/html/y2007/12/03/42/mysql-41%e4%bb%a5%e4%b8%8a%e7%89%88%e6%9c%ac%e4%b8%ad%e6%96%87%e4%b9%b1%e7%a0%81%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95%e9%9b%86%e9%94%a6.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL 常用命令整理</title>
		<link>http://blog.thematice.com/html/y2007/12/01/41/mysql-%e5%b8%b8%e7%94%a8%e5%91%bd%e4%bb%a4%e6%95%b4%e7%90%86.html#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-%25e5%25b8%25b8%25e7%2594%25a8%25e5%2591%25bd%25e4%25bb%25a4%25e6%2595%25b4%25e7%2590%2586</link>
		<comments>http://blog.thematice.com/html/y2007/12/01/41/mysql-%e5%b8%b8%e7%94%a8%e5%91%bd%e4%bb%a4%e6%95%b4%e7%90%86.html#comments</comments>
		<pubDate>Sat, 01 Dec 2007 04:21:40 +0000</pubDate>
		<dc:creator>稀饭</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[command]]></category>

		<guid isPermaLink="false">http://www.gruelstate.cn/index.php/2007/12/01/mysql-%e5%b8%b8%e7%94%a8%e5%91%bd%e4%bb%a4%e6%95%b4%e7%90%86/</guid>
		<description><![CDATA[有很多朋友虽然安装好了 MySQL 但却不知如何使用它。在这篇文章中我们就从连接 MySQL、修改密码、增加用户等方面来学习一些 MySQL 的常用命令。 　　一、连接MySQL。 　　格式： mysql -h主机地址 -u用户名 －p用户密码 　　1、例1：连接到本机上的MYSQL。 　　首先在打开 DOS 窗口，然后进入目录 mysql\bin，再键入命令mysql -uroot -p，回车后提示你输密码，如果刚安装好 MySQL，超级用户 root 是没有密码的，故直接回车即可进入到 MySQL 中了，MySQL 的提示符是：mysql> 　　2、例2：连接到远程主机上的 MySQL。 　　假设远程主机的IP为：110.110.110.110，用户名为root，密码为abcd123。则键入以下命令： mysql -h110.110.110.110 -uroot -pabcd123 （注:u与root可以不用加空格，其它也一样） 　　3、退出 MySQL 命令： exit （回车） 　　二、修改密码。 　　格式：mysqladmin -u用户名 -p旧密码 password 新密码 　　1、例1：给root加个密码ab12。首先在DOS下进入目录mysqlbin，然后键入以下命令 mysqladmin -uroot -password ab12 注：因为开始时root没有密码，所以-p旧密码一项就可以省略了。 2、例2：再将root的密码改为djg345。 mysqladmin -uroot -pab12 password [...]]]></description>
		<wfw:commentRss>http://blog.thematice.com/html/y2007/12/01/41/mysql-%e5%b8%b8%e7%94%a8%e5%91%bd%e4%bb%a4%e6%95%b4%e7%90%86.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL数据库自动恢复的简单操作过程</title>
		<link>http://blog.thematice.com/html/y2007/12/01/39/mysql%e6%95%b0%e6%8d%ae%e5%ba%93%e8%87%aa%e5%8a%a8%e6%81%a2%e5%a4%8d%e7%9a%84%e7%ae%80%e5%8d%95%e6%93%8d%e4%bd%9c%e8%bf%87%e7%a8%8b.html#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql%25e6%2595%25b0%25e6%258d%25ae%25e5%25ba%2593%25e8%2587%25aa%25e5%258a%25a8%25e6%2581%25a2%25e5%25a4%258d%25e7%259a%2584%25e7%25ae%2580%25e5%258d%2595%25e6%2593%258d%25e4%25bd%259c%25e8%25bf%2587%25e7%25a8%258b</link>
		<comments>http://blog.thematice.com/html/y2007/12/01/39/mysql%e6%95%b0%e6%8d%ae%e5%ba%93%e8%87%aa%e5%8a%a8%e6%81%a2%e5%a4%8d%e7%9a%84%e7%ae%80%e5%8d%95%e6%93%8d%e4%bd%9c%e8%bf%87%e7%a8%8b.html#comments</comments>
		<pubDate>Sat, 01 Dec 2007 02:01:21 +0000</pubDate>
		<dc:creator>稀饭</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mysql DBA]]></category>
		<category><![CDATA[mysqlbilog]]></category>

		<guid isPermaLink="false">http://www.gruelstate.cn/index.php/2007/12/01/mysql%e6%95%b0%e6%8d%ae%e5%ba%93%e8%87%aa%e5%8a%a8%e6%81%a2%e5%a4%8d%e7%9a%84%e7%ae%80%e5%8d%95%e6%93%8d%e4%bd%9c%e8%bf%87%e7%a8%8b/</guid>
		<description><![CDATA[如 果MySQL服务器启用了二进制日志，你可以使用mysqlbinlog工具来恢复从指定的时间点开始 (例如，从你最后一次备份)直到现在或另一个指定的时间点的数据。关于启用二进制日志的信息，参见5.11.3节，“二进制日志”。对于 mysqlbinlog的详细信息，参见8.6节，“mysqlbinlog：用于处理二进制日志文件的实用工具”。 要 想从二进制日志恢复数据，你需要知道当前二进制日志文件的路径和文件名。一般可以从选项文件(即my.cnf or my.ini，取决于你的系统)中找到路径。如果未包含在选项文件中，当服务器启动时，可以在命令行中以选项的形式给出。启用二进制日志的选项为&#8211; log-bin。要想确定当前的二进制日志文件的文件名，输入下面的MySQL语句： SHOW BINLOG EVENTS \G 你还可以从命令行输入下面的内容： mysql --user=root -pmy_pwd -e 'SHOW BINLOG EVENTS \G' 将密码my_pwd替换为服务器的root密码。 1. 指定恢复时间 对 于MySQL 4.1.4，可以在mysqlbinlog语句中通过&#8211;start-date和&#8211;stop-date选项指定DATETIME格式的起止时间。举例说 明，假设在今天上午10:00(今天是2005年4月20日)，执行SQL语句来删除一个大表。要想恢复表和数据，你可以恢复前晚上的备份，并输入： mysqlbinlog --stop-date="2005-04-20 9:59:59" /var/log/mysql/bin.123456 \ &#124; mysql -u root -pmypwd 该命令将恢复截止到在&#8211;stop-date选项中以DATETIME格式给出的日期和时间的所有数据。如果你没有检测到几个小时后输入的错误的SQL语句，可能你想要恢复后面发生的活动。根据这些，你可以用起使日期和时间再次运行mysqlbinlog： mysqlbinlog --start-date="2005-04-20 10:01:00" /var/log/mysql/bin.123456 \ &#124; mysql -u root -pmypwd \ 在该行中，从上午10:01登录的SQL语句将运行。组合执行前夜的转储文件和mysqlbinlog的两行可以将所有数据恢复到上午10:00前一秒钟。你应检查日志以确保时间确切。下一节介绍如何实现。 2. 指定恢复位置 也 [...]]]></description>
		<wfw:commentRss>http://blog.thematice.com/html/y2007/12/01/39/mysql%e6%95%b0%e6%8d%ae%e5%ba%93%e8%87%aa%e5%8a%a8%e6%81%a2%e5%a4%8d%e7%9a%84%e7%ae%80%e5%8d%95%e6%93%8d%e4%bd%9c%e8%bf%87%e7%a8%8b.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mysql实现高可用性实例</title>
		<link>http://blog.thematice.com/html/y2007/11/24/36/mysql%e5%ae%9e%e7%8e%b0%e9%ab%98%e5%8f%af%e7%94%a8%e6%80%a7%e5%ae%9e%e4%be%8b.html#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql%25e5%25ae%259e%25e7%258e%25b0%25e9%25ab%2598%25e5%258f%25af%25e7%2594%25a8%25e6%2580%25a7%25e5%25ae%259e%25e4%25be%258b</link>
		<comments>http://blog.thematice.com/html/y2007/11/24/36/mysql%e5%ae%9e%e7%8e%b0%e9%ab%98%e5%8f%af%e7%94%a8%e6%80%a7%e5%ae%9e%e4%be%8b.html#comments</comments>
		<pubDate>Sat, 24 Nov 2007 01:55:44 +0000</pubDate>
		<dc:creator>稀饭</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[hotrep]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.gruelstate.cn/index.php/2007/11/24/mysql%e5%ae%9e%e7%8e%b0%e9%ab%98%e5%8f%af%e7%94%a8%e6%80%a7%e5%ae%9e%e4%be%8b/</guid>
		<description><![CDATA[做人要厚道，转载请保留原文链接：http://www.entage.net/1/viewspace_1868.html 作者：九尾银狐 关于本文 本文给出了一个MYSQL HA的实列，简单说明了如何实现MYSQL的高可用性，方法并非仅此一种，感兴趣的朋友可参考相关资料。 背景 当前大多网站采用MYSQL＋Linux＋APACHE这种经典配置，如何防止单点失败造成的整个网站的不可用是网站管理者必须要考虑的问题，其中数据库的高可用性（Database server’s high availability）是重中之重。 对于数据库的高可用性，各商业软件的厂商都有各自的解决方案，比如Oracle OPS server和IBM DB2 (share-nothing architecture)。最近MYSQL AB也发布了MYSQL cluster 软件，使用与IBM DB2类似的技术。 MySQL cluster可能会是日后最理想的方案，但是从资源、可集成度方面考虑，笔者将给出一个简单实用的方案供大家借鉴。 实现原理 通过Linux HA 软件 heartbeat 实现IP的自动漂移，即当一台服务器宕机后，浮动IP（整个cluster的对外IP ）自动漂移到另外一台服务器。 通过Mysql自身的replication 实现不同机器上多个数据库的同步 整体性能 此方案将会降低MYSQL 1％左右的性能，可用性及数据安全性将大有提高，同时服务器的切换对终端使用者是透明的，终端应用不需要进行更改。 所需硬件 安装有双网卡的配置大致相同的服务器或工作机两台（测试而已，用Vmware虚拟吧） 一条交叉网线(用于双机对连的心跳线) 所需软件 Linux HA 软件 heartbeat （只支持两个节点） 软件主页：http://www.linux-ha.org/ Mysql 软件主页：www.mysql.com 实现步骤 一、设置硬件环境： Node1: 计算机名：RHEL1 eth0    : 192.168.168.1/255.255.255.0 eth1    : [...]]]></description>
		<wfw:commentRss>http://blog.thematice.com/html/y2007/11/24/36/mysql%e5%ae%9e%e7%8e%b0%e9%ab%98%e5%8f%af%e7%94%a8%e6%80%a7%e5%ae%9e%e4%be%8b.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>教你怎样配置MySQL数据库双机热备份</title>
		<link>http://blog.thematice.com/html/y2007/11/24/35/%e6%95%99%e4%bd%a0%e6%80%8e%e6%a0%b7%e9%85%8d%e7%bd%aemysql%e6%95%b0%e6%8d%ae%e5%ba%93%e5%8f%8c%e6%9c%ba%e7%83%ad%e5%a4%87%e4%bb%bd.html#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=%25e6%2595%2599%25e4%25bd%25a0%25e6%2580%258e%25e6%25a0%25b7%25e9%2585%258d%25e7%25bd%25aemysql%25e6%2595%25b0%25e6%258d%25ae%25e5%25ba%2593%25e5%258f%258c%25e6%259c%25ba%25e7%2583%25ad%25e5%25a4%2587%25e4%25bb%25bd</link>
		<comments>http://blog.thematice.com/html/y2007/11/24/35/%e6%95%99%e4%bd%a0%e6%80%8e%e6%a0%b7%e9%85%8d%e7%bd%aemysql%e6%95%b0%e6%8d%ae%e5%ba%93%e5%8f%8c%e6%9c%ba%e7%83%ad%e5%a4%87%e4%bb%bd.html#comments</comments>
		<pubDate>Sat, 24 Nov 2007 01:54:40 +0000</pubDate>
		<dc:creator>稀饭</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[hotrep]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.gruelstate.cn/index.php/2007/11/24/%e6%95%99%e4%bd%a0%e6%80%8e%e6%a0%b7%e9%85%8d%e7%bd%aemysql%e6%95%b0%e6%8d%ae%e5%ba%93%e5%8f%8c%e6%9c%ba%e7%83%ad%e5%a4%87%e4%bb%bd/</guid>
		<description><![CDATA[1、mysql 数据库没有增量备份的机制，当数据量太大的时候备份是一个很大的问题。还好 mysql 数据库提供了一种主从备份的机制，其实就是把主数据库的所有的数据同时写到备份数据库中。实现 mysql 数据库的热备份。　　2、要想实现双机的热备首先要了解主从数据库服务器的版本的需求。要实现热备 mysql 的版本都要高于3.2，还有一个基本的原则就是作为从数据库的数据库版本可以高于主服务器数据库的版本，但是不可以低于主服务器的数据库版本。 3、设置主数据库服务器： a. 首先查看主服务器的版本是否是支持热备的版本。然后查看 my.cnf(类 unix)或者 my.ini(windows)中 mysqld 配置块的配置有没有 log-bin (记录数据库更改日志)，因为 mysql 的复制机制是基于日志的复制机制，所以主服务器一定要支持更改日志才行。然后设置要写入日志的数据库或者不要写入日志的数据库。这样只有您感兴趣的数据库的更改才写入到数据库的日志中。 server-id=1 //数据库的 id 这个应该默认是1就不用改动 log-bin=log_name //日志文件的名称，这里可以制定日志到别的目录 如果没有设置则默认主机名的一个日志名称 binlog-do-db=db_name //记录日志的数据库 binlog-ignore-db=db_name //不记录日志的数据库 以上的如果有多个数据库用”,”分割开，然后设置同步数据库的用户帐号 mysql&#62; GRANT REPLICATION SLAVE ON *.* -&#62; TO &#8216;repl&#8217;@'%.mydomain.com&#8217; IDENTIFIED BY &#8216;slavepass&#8217;; 4.0.2 以前的版本, 因为不支持 REPLICATION 要使用下面的语句来实现这个功能 mysql&#62; GRANT FILE ON *.* -&#62; [...]]]></description>
		<wfw:commentRss>http://blog.thematice.com/html/y2007/11/24/35/%e6%95%99%e4%bd%a0%e6%80%8e%e6%a0%b7%e9%85%8d%e7%bd%aemysql%e6%95%b0%e6%8d%ae%e5%ba%93%e5%8f%8c%e6%9c%ba%e7%83%ad%e5%a4%87%e4%bb%bd.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>配置MySQL主从复制(Replication)</title>
		<link>http://blog.thematice.com/html/y2007/11/19/28/%e9%85%8d%e7%bd%aemysql%e4%b8%bb%e4%bb%8e%e5%a4%8d%e5%88%b6replication.html#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=%25e9%2585%258d%25e7%25bd%25aemysql%25e4%25b8%25bb%25e4%25bb%258e%25e5%25a4%258d%25e5%2588%25b6replication</link>
		<comments>http://blog.thematice.com/html/y2007/11/19/28/%e9%85%8d%e7%bd%aemysql%e4%b8%bb%e4%bb%8e%e5%a4%8d%e5%88%b6replication.html#comments</comments>
		<pubDate>Sun, 18 Nov 2007 22:54:38 +0000</pubDate>
		<dc:creator>稀饭</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql备份]]></category>
		<category><![CDATA[mysql复制]]></category>
		<category><![CDATA[replication]]></category>
		<category><![CDATA[知识/探索]]></category>

		<guid isPermaLink="false">http://www.gruelstate.cn/index.php/2007/11/19/%e9%85%8d%e7%bd%aemysql%e4%b8%bb%e4%bb%8e%e5%a4%8d%e5%88%b6replication/</guid>
		<description><![CDATA[MySQL支持单向、异步复制，复制过程中一个服务器充当主服务器，而一个或多个其它服务器充当从服务器。主服务器将更新写入二进制日志文件，并维护日志文件的一个索引以跟踪日志循环。当一个从服务器连接到主服务器时，它通知主服务器从服务器在日志中读取的最后一次成功更新的位置。从服务器接收从那时起发生的任何更新，然后封锁并等待主服务器通知下一次更新。 为什么使用主从复制？ 1、主服务器/从服务器设置增加了健壮性。主服务器出现问题时，你可以切换到从服务器作为备份。 2、通过在主服务器和从服务器之间切分处理客户查询的负荷，可以得到更好的客户响应时间。但是不要同时在主从服务器上进行更新，这样可能引起冲突。 3、使用复制的另一个好处是可以使用一个从服务器执行备份，而不会干扰主服务器。在备份过程中主服务器可以继续处理更新。 MySQL使用3个线程来执行复制功能(其中1个在主服务器上，另两个在从服务器上。当发出START SLAVE时，从服务器创建一个I/O线程，以连接主服务器并让主服务器发送二进制日志。主服务器创建一个线程将二进制日志中的内容发送到从服务器。从服务器I/O线程读取主服务器Binlog Dump线程发送的内容并将该数据拷贝到从服务器数据目录中的本地文件中，即中继日志。第3个线程是SQL线程，从服务器使用此线程读取中继日志并执行日志中包含的更新。SHOW PROCESSLIST语句可以查询在主服务器上和从服务器上发生的关于复制的信息。 默认中继日志使用host_name-relay-bin.nnnnnn形式的文件名，其中host_name是从服务器主机名，nnnnnn是序列号。用连续序列号来创建连续中继日志文件，从000001开始。从服务器跟踪中继日志索引文件来识别目前正使用的中继日志。默认中继日志索引文件名为host_name-relay-bin.index。在默认情况，这些文件在从服务器的数据目录中被创建。中继日志与二进制日志的格式相同，并且可以用mysqlbinlog读取。当SQL线程执行完中继日志中的所有事件后，中继日志将会被自动删除。 从服务器在数据目录中另外创建两个状态文件&#8211;master.info和relay-log.info。状态文件保存在硬盘上，从服务器关闭时不会丢失。下次从服务器启动时，读取这些文件以确定它已经从主服务器读取了多少二进制日志，以及处理自己的中继日志的程度。 设置主从复制： 1、确保在主服务器和从服务器上安装的MySQL版本相同，并且最好是MySQL的最新稳定版本。 2、在主服务器上为复制设置一个连接账户。该账户必须授予REPLICATION SLAVE权限。如果账户仅用于复制(推荐这样做)，则不需要再授予任何其它权限。 mysql&#62; GRANT REPLICATION SLAVE ON *.*     -&#62; TO &#8216;replication&#8217;@'%.yourdomain.com&#8217; IDENTIFIED BY &#8216;slavepass&#8217;; 3、执行FLUSH TABLES WITH READ LOCK语句清空所有表和块写入语句： mysql&#62; FLUSH TABLES WITH READ LOCK； 保持mysql客户端程序不要退出。开启另一个终端对主服务器数据目录做快照。 shell&#62; cd /usr/local/mysql/ shell&#62; tar -cvf /tmp/mysql-snapshot.tar ./data 如果从服务器的用户账户与主服务器的不同，你可能不想复制mysql数据库。在这种情况下，应从归档中排除该数据库。你也不需要在归档中包括任何日志文件或者master.info或relay-log.info文件。 当FLUSH TABLES WITH READ LOCK所置读锁定有效时（即mysql客户端程序不退出)，读取主服务器上当前的二进制日志名和偏移量值： mysql [...]]]></description>
		<wfw:commentRss>http://blog.thematice.com/html/y2007/11/19/28/%e9%85%8d%e7%bd%aemysql%e4%b8%bb%e4%bb%8e%e5%a4%8d%e5%88%b6replication.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL 备份和恢复策略（三）</title>
		<link>http://blog.thematice.com/html/y2007/11/19/27/mysql-%e5%a4%87%e4%bb%bd%e5%92%8c%e6%81%a2%e5%a4%8d%e7%ad%96%e7%95%a5%ef%bc%88%e4%b8%89%ef%bc%89.html#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-%25e5%25a4%2587%25e4%25bb%25bd%25e5%2592%258c%25e6%2581%25a2%25e5%25a4%258d%25e7%25ad%2596%25e7%2595%25a5%25ef%25bc%2588%25e4%25b8%2589%25ef%25bc%2589</link>
		<comments>http://blog.thematice.com/html/y2007/11/19/27/mysql-%e5%a4%87%e4%bb%bd%e5%92%8c%e6%81%a2%e5%a4%8d%e7%ad%96%e7%95%a5%ef%bc%88%e4%b8%89%ef%bc%89.html#comments</comments>
		<pubDate>Sun, 18 Nov 2007 22:47:18 +0000</pubDate>
		<dc:creator>稀饭</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql备份恢复]]></category>
		<category><![CDATA[mysql备份策略]]></category>
		<category><![CDATA[mysql恢复策略]]></category>
		<category><![CDATA[知识/探索]]></category>

		<guid isPermaLink="false">http://www.gruelstate.cn/index.php/2007/11/19/mysql-%e5%a4%87%e4%bb%bd%e5%92%8c%e6%81%a2%e5%a4%8d%e7%ad%96%e7%95%a5%ef%bc%88%e4%b8%89%ef%bc%89/</guid>
		<description><![CDATA[mysqlDailyBackup.sh注释：  #!/bin/sh # Name:mysqlDailyBackup.sh # PS:MySQL DataBase Daily Backup. # Write by:i.Stone # Last Modify:2007-11-17 # # 定义变量，请根据具体情况修改 # 定义数据库目录和数据目录 scriptsDir=`pwd` mysqlDir=/usr/local/mysql dataDir=$mysqlDir/data # 定义用于备份数据库的用户名和密码 user=root userPWD=111111 # 定义备份目录，每日备份文件备份到$dataBackupDir/daily dataBackupDir=/tmp/mysqlbackup dailyBackupDir=$dataBackupDir/daily # 定义邮件正文文件 eMailFile=$dataBackupDir/email.txt # 定义邮件地址 eMail=alter@somode.com # 定义日志文件 logFile=$dataBackupDir/mysqlbackup.log # 得到数据库所在主机的主机名 HOSTNAME=`uname -n` # echo “” &#62; $eMailFile echo $(date +”%y-%m-%d %H:%M:%S”) &#62;&#62; $eMailFile [...]]]></description>
		<wfw:commentRss>http://blog.thematice.com/html/y2007/11/19/27/mysql-%e5%a4%87%e4%bb%bd%e5%92%8c%e6%81%a2%e5%a4%8d%e7%ad%96%e7%95%a5%ef%bc%88%e4%b8%89%ef%bc%89.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MySQL 备份和恢复策略（二）</title>
		<link>http://blog.thematice.com/html/y2007/11/19/26/mysql-%e5%a4%87%e4%bb%bd%e5%92%8c%e6%81%a2%e5%a4%8d%e7%ad%96%e7%95%a5%ef%bc%88%e4%ba%8c%ef%bc%89.html#utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mysql-%25e5%25a4%2587%25e4%25bb%25bd%25e5%2592%258c%25e6%2581%25a2%25e5%25a4%258d%25e7%25ad%2596%25e7%2595%25a5%25ef%25bc%2588%25e4%25ba%258c%25ef%25bc%2589</link>
		<comments>http://blog.thematice.com/html/y2007/11/19/26/mysql-%e5%a4%87%e4%bb%bd%e5%92%8c%e6%81%a2%e5%a4%8d%e7%ad%96%e7%95%a5%ef%bc%88%e4%ba%8c%ef%bc%89.html#comments</comments>
		<pubDate>Sun, 18 Nov 2007 22:46:18 +0000</pubDate>
		<dc:creator>稀饭</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql备份恢复]]></category>
		<category><![CDATA[mysql备份策略]]></category>
		<category><![CDATA[mysql恢复策略]]></category>
		<category><![CDATA[知识/探索]]></category>

		<guid isPermaLink="false">http://www.gruelstate.cn/index.php/2007/11/19/mysql-%e5%a4%87%e4%bb%bd%e5%92%8c%e6%81%a2%e5%a4%8d%e7%ad%96%e7%95%a5%ef%bc%88%e4%ba%8c%ef%bc%89/</guid>
		<description><![CDATA[备份策略三、使用mysqldump备份数据库 mysqldump 是采用SQL级别的备份机制，它将数据表导成 SQL 脚本文件，在不同的 MySQL 版本之间升级时相对比较合适，这也是最常用的备份方法。mysqldump 比直接拷贝要慢些。关于mysqldump的更详细解释见最后的附录。 对于中等级别业务量的系统来说，备份策略可以这么定：第一次完全备份，每天一次增量备份，每周再做一次完全备份，如此一直重复。而对于重要的且繁忙的系统来说，则可能需要每天一次全量备份，每小时一次增量备份，甚至更频繁。为了不影响线上业务，实现在线备份，并且能增量备份，最好的办法就是采用主从复制机制(replication)，在 slave 机器上做备份。 备份策略布置： （1）、创建备份目录 Shell&#62; mkdir /tmp/mysqlbackup Shell&#62; mkdir /tmp/mysqlbackup/daily （2）、启用二进制日志 采用 binlog 的方法相对来说更灵活，省心省力，而且还可以支持增量备份。 启用 binlog 时必须要重启 mysqld。首先，关闭 mysqld，打开 /etc/my.cnf，加入以下几行： [mysqld] log-bin 然后启动 mysqld 就可以了。运行过程中会产生 HOSTNAME-bin.000001 以及 HOSTNAME-bin.index，前面的文件是 mysqld 记录所有对数据的更新操作，后面的文件则是所有 binlog 的索引，都不能轻易删除。关于 binlog 的更详细信息请查看手册。 （3）、配置SSH密钥登录，用于将MySQL备份传送到备份服务器（如果备份服务器为Windows，请跳过此部）。 1）、在MySQL所在服务器（192.168.0.20）生成SSH密钥 [root@lab ~]# ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa):  //直接回车 Enter passphrase (empty for no passphrase):         //直接回车，不使用密码 Enter same passphrase again:                     //直接回车，不使用密码 Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: c2:96:9f:2d:5a:8e:08:42:43:35:2f:85:5e:72:f8:1c root@lab &#160; 2）、在备份服务器（192.168.0.200）上创建目录，修改权限，并传送公钥。 [root@lab ~]# ssh 192.168.0.200 ”mkdir .ssh;chmod 0700 .ssh” The authenticity of host &#8217;192.168.0.200 (192.168.0.200)&#8217; can&#8217;t be established. RSA key fingerprint is 37:57:55:c1:32:f1:dd:bb:1b:8a:13:6f:89:fb:b8:9d. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added &#8217;192.168.0.200&#8242; (RSA) to the list of known hosts. root@192.168.0.200&#8242;s password:     //输入备份服务器的root密码 [root@lab ~]# scp .ssh/id_rsa.pub 192.168.0.200:.ssh/authorized_keys2 root@192.168.0.200&#8242;s password:  id_rsa.pub                                             100%  218     0.2KB/s   00:00     3）、测试SSH登录 [root@lab ~]# ssh 192.168.0.200       //测试SSH登录 Last login: Fri Nov 16 10:34:02 2007 from 192.168.0.20 [root@lib ~]#  &#160; （4）、设置crontab任务，每天执行备份脚本 shell&#62; crontab -e #每个星期日凌晨3:00执行完全备份脚本 0 3 * * 0 /root/MySQLBackup/mysqlFullBackup.sh &#62;/dev/null 2&#62;&#38;1 #周一到周六凌晨3:00做增量备份 0 3 * * 1-6 /root/MySQLBackup/mysqlDailyBackup.sh &#62;/dev/null 2&#62;&#38;1 &#160; mysqlFullBackup.sh注释： #!/bin/sh # Name:mysqlFullBackup.sh # PS:MySQL DataBase Full [...]]]></description>
		<wfw:commentRss>http://blog.thematice.com/html/y2007/11/19/26/mysql-%e5%a4%87%e4%bb%bd%e5%92%8c%e6%81%a2%e5%a4%8d%e7%ad%96%e7%95%a5%ef%bc%88%e4%ba%8c%ef%bc%89.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

