<?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://zhiqiang.org/blog/tag/mysql/feed" rel="self" type="application/rss+xml" />
	<link>http://zhiqiang.org/blog</link>
	<description>zhiqiang&#039;s personal blog</description>
	<lastBuildDate>Wed, 08 Sep 2010 04:07:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>搞定乱码，WordPress搬家到dreamhost</title>
		<link>http://zhiqiang.org/blog/it/to-get-gibberish-wordpress-move-to-dreamhost.html</link>
		<comments>http://zhiqiang.org/blog/it/to-get-gibberish-wordpress-move-to-dreamhost.html#comments</comments>
		<pubDate>Mon, 03 Jul 2006 12:17:48 +0000</pubDate>
		<dc:creator>zhiqiang</dc:creator>
				<category><![CDATA[IT技术]]></category>
		<category><![CDATA[记事本]]></category>
		<category><![CDATA[Dreamhost]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[phpmyadmin]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[搬家]]></category>
		<category><![CDATA[数据库]]></category>

		<guid isPermaLink="false">http://zhiqiang.org/blog/359.html</guid>
		<description><![CDATA[两个月前一时冲动，花了大约80大洋买了一年的dreamhost主机。刚买的时候就试图把Blog搬到它上面去，不过由于数据库的乱码原因，一直没有成功。最近，多个电信的朋友告诉我我的Blog速度&#8220;慢得不能忍受&#8221;，今天下午下定决心搞定数据库，哪知道一下子就弄了4个小时，到现在才基本上搞定。现在正式进入测试期，欢迎报告Bug和异常情况。
先说一下我是怎么解决数据库...]]></description>
			<content:encoded><![CDATA[<p>两个月前一时冲动，花了大约80大洋买了一年的<a href="http://www.dreamhost.com">dreamhost主机</a>。刚买的时候就试图把Blog搬到它上面去，不过由于数据库的乱码原因，一直没有成功。最近，多个电信的朋友告诉我我的Blog速度&ldquo;慢得不能忍受&rdquo;，今天下午下定决心搞定数据库，哪知道一下子就弄了4个小时，到现在才基本上搞定。现在正式进入测试期，欢迎报告Bug和异常情况。</p>
<p>先说一下我是怎么解决数据库乱码问题的。最开始的时候在phpmyadmin里面直接导入备份文件（使用WordPress自带的database backup生成），最后文章里面大部分显示正常，但是间或的有些汉字变成了乱码（在FireFox下变成两个?号）。在无数次失败的尝试和Baidu的帮助下，最后找到解决方案：</p>
<ol>
<li>使用WordPress自带的database backup生成备份文件（打开这个文件，里面中文是正常的，而如果直接从phpmyadmin里面导出数据库，中文都是乱码）。 </li>
<li>在phpMyadmin中设定MySQL 字符集: UTF-8 Unicode (utf8) （一般来说默认就是这个） </li>
<li>在phpMyadmin中设定MySQL 连接校对: utf8_general_ci </li>
<li><font color="#ff0000">用文本编辑器如EditPlus 打开备份的数据库文件，查找&quot;DEFAULT CHARSET=latin1&quot; 用&quot;DEFAULT CHARSET=utf8&quot;替换。</font> </li>
<li>用phpMyadmin导入上面修改过的备份文件。 </li>
<li>修改wp-includes/wp-db.php內的资料连线设定。详细的修改方式是这样的：<br />$this-&gt;dbh = @mysql_connect($dbhost,$dbuser,$dbpassword);<br />//加上下面这行<br /><code>$this-&gt;query(&quot;SET NAMES 'utf8'&quot; );</code> </li>
</ol>
<p>这样做之后，不但页面上没有乱码，在数据库里面也可以直接看到中文。另外，在解决过程中得到了<a target="_blank" href="http://lucifr.com">Lucifer</a>和<a target="_blank" href="http://www.sunxiunan.com/">Sunwell</a>帮助，关键的一步从<a target="_blank" href="http://www.jekee.com/wordpress%e6%81%a2%e5%a4%8d%e6%95%b0%e6%8d%ae%e5%ba%93%e5%90%8e%e4%b9%b1%e7%a0%81%e9%97%ae%e9%a2%98%e7%9a%84%e8%a7%a3%e5%86%b3.html">wordpress恢复数据库后乱码问题的解决</a>看来的，一并表示感谢。</p>
<p>我和Dreamhost：</p>
<ul>
<li>我上Dreamhost还是太慢了，特别是它的FTP，无法忍受。 </li>
<li>Dreamhost的CPU速度比我原来的实验室的服务器还要慢，看看页面生成时间，有时候竟然需要2秒以上，郁闷。 </li>
<li>Dreamhost的服务器在国外，教育网访问需要代理，包括我自己，:(。 </li>
<li>不用担心备案问题了，不过我担心Dreamhost整体被封。 </li>
<li>十个月后空间到期后咋办呢？对我来说，搬家很快的，拎着数据库跑就行了。图片啥的我都放到Flickr和Picasa Web上了。不过寻找新空间是个大问题，暂时不管了。 </li>
</ul>
<p>另外，Dreamhost的unix主机的文件名是分大小写的，结果导致我有些ajax程序异常，不过现在已修正。</p>
<div><h2>相关文章</h2><ul><li><a href="http://zhiqiang.org/blog/it/move-to-the-blog-server-bluehost.html">blog服务器搬家到bluehost</a> <small>去年5月份买的Dreamhost快要到期了，趁cosβ组织Bluehost分享的机会，提前搬到了bluehost。 bluehost和dreamhost是中国独立blog用得最多的两个主机空间，而bluehost...</small></li><li><a href="http://zhiqiang.org/blog/science/computer-science/move-blogbus-data-to-wordpress.html">BlogBus搬家文件转WordPress导入文件</a> <small>  最近给某blog做了一次搬家，从Sina转到WordPress独立博客，网上已经有很多工具和方法，但可用而且耗用的不多，总是有一些乱七八糟的问题。这里说一...</small></li><li><a href="http://zhiqiang.org/blog/it/wordpress-chinese-translation-of-documents-initiative.html">WordPress中文文档翻译倡议</a> <small>这是一封WordPress中文文档翻译倡议书。&nbsp;希望大家对倡议书所及内容发表意见和建议，并尽个人所能参与到WordPress中文文档翻译计划中来，谢谢大家...</small></li><li><a href="http://zhiqiang.org/blog/it/wordpress-accelerate-the-pace-of-pages-printed-in-the-generation-and.html">加快WordPress的页面生成和载入速度</a> <small>前一阵，此blog的页面打开速度慢的要命，我每次打开都需要大约10秒钟的时间。而通过Google Analytics的数据看到，70%+用户在这个blog的停留时间还不到十...</small></li><li><a href="http://zhiqiang.org/blog/it/wordspew-plug-litter-message-solution.html">wordspew插件的垃圾留言的解决办法</a> <small>wordspew插件可以给Blog添加一个实时的ajax聊天窗口，也可以用来当作一个简单留言板，具体效果可见本blog左侧栏的在线聊天模块。本来一直用得挺好的...</small></li><li><a href="http://zhiqiang.org/blog/it/wordpress-21-solution-can-not-remove-the-article-upgrade-to-213.html">WordPress 2.1无法删除文章解决方法 &amp; 升级到2.1.3</a> <small>如果你在升级WordPress到2.1之后遇到以下情况：  无法删除文章(post)在文章列表的"Edit"链接旁边，看不到该有的"Delete"链接。在Edit文章界面，点击"Delete thi...</small></li><li><a href="http://zhiqiang.org/blog/it/wordpress-blog-has-different-domains.html">同一WordPress的blog可拥有多个域名</a> <small>注：与生成静态化文件的插件冲突。 发个技术贴。相同数据库的blog，但可以用不同域名访问。 效果展示：  http://zhiqiang.org/blog/  https://zhiqiang.org/blog/ (h...</small></li><li><a href="http://zhiqiang.org/blog/it/my-experiences-and-views-blog.html">我的Blog经历和一些看法</a> <small>我是从去年3月开始接触Blog的，最开始注册在MSN Spaces上面，中途见异思迁了一次，搬到sina blog上去了，不过后来还是搬回去了。到今年4月，觉得MSN Space...</small></li><li><a href="http://zhiqiang.org/blog/it/dreamhost-system-load-average-load-recording-and-analysis.html">Dreamhost系统Load average负载记录和分析</a> <small>Dreamhost的空间马上就要到期了，面临着继续留在Dreamhost还是搬去Bluehost的选择。对我来说，主机速度是决定性因素。这几天用crontab把我的Dreamhost空间所...</small></li><li><a href="http://zhiqiang.org/blog/it/google-gears-in-wordpress-26.html">WordPress 2.6中的Google Gears</a> <small>似乎大家对于Google Gears关注得很少。我认为Google Gears结合浏览器，就是另类的桌面软件，在不断丰富Google的桌面产品线。现在的Google docs已经可以在离...</small></li></ul></div>    <p></p>
    <hr noshade style="margin:0;height:1px" />
    <p>&copy; zhiqiang for <a href="http://zhiqiang.org/blog">阅微堂</a>, 2006. | <a href="http://zhiqiang.org/blog/it/to-get-gibberish-wordpress-move-to-dreamhost.html">&#38142;&#25509;</a> | <a href="http://zhiqiang.org/blog/it/to-get-gibberish-wordpress-move-to-dreamhost.html#comments">46 &#26465;&#35780;&#35770;</a></p>]]></content:encoded>
			<wfw:commentRss>http://zhiqiang.org/blog/it/to-get-gibberish-wordpress-move-to-dreamhost.html/feed</wfw:commentRss>
		<slash:comments>46</slash:comments>
		</item>
	</channel>
</rss>
