<?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>cap&#039;n webb &#187; MySQL</title>
	<atom:link href="http://blog.dataich.com/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.dataich.com</link>
	<description>almost all things about it</description>
	<lastBuildDate>Thu, 12 Jan 2012 03:38:00 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>HomebrewでApache2.2+MySQL5.1+PHP5.3環境を構築</title>
		<link>http://blog.dataich.com/2011/11/01/install-apache2-2-mysql5-1php5-3-using-homebrew/</link>
		<comments>http://blog.dataich.com/2011/11/01/install-apache2-2-mysql5-1php5-3-using-homebrew/#comments</comments>
		<pubDate>Tue, 01 Nov 2011 13:48:09 +0000</pubDate>
		<dc:creator>dataich</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Homebrew]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.dataich.com/?p=1081</guid>
		<description><![CDATA[残念ながらHomebrewのリポジトリにはApache、PHPがなく、MySQLは5.5となっています。もっともApacheとPHPに関しては、システムに入ってるものはインストールしないというHomebrewの方針なんだ [...]]]></description>
			<content:encoded><![CDATA[<p>残念ながらHomebrewのリポジトリにはApache、PHPがなく、MySQLは5.5となっています。もっともApacheとPHPに関しては、システムに入ってるものはインストールしないというHomebrewの方針なんだろうと思いますが。で探し回っているとこんなものを見つけました。</p>
<blockquote><p>Alternate formulae repos for Homebrew<br />
<a href="https://github.com/adamv/homebrew-alt/" onclick="pageTracker._trackPageview('/outgoing/github.com/adamv/homebrew-alt/?referer=');">https://github.com/adamv/homebrew-alt/</a></p></blockquote>
<p>homebrewのリポジトリにはないものを野良的に公開してくださっています。上記利用させていただいて、MAMP環境を構築します。</p>
<h3>PHP5.3のインストール</h3>
<p>HomebrewはFomulaの直URL指定でもインストールすることができます。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">brew <span style="color: #c20cb9; font-weight: bold;">install</span> https:<span style="color: #000000; font-weight: bold;">//</span>raw.github.com<span style="color: #000000; font-weight: bold;">/</span>adamv<span style="color: #000000; font-weight: bold;">/</span>homebrew-alt<span style="color: #000000; font-weight: bold;">/</span>master<span style="color: #000000; font-weight: bold;">/</span>duplicates<span style="color: #000000; font-weight: bold;">/</span>php.rb <span style="color: #660033;">--with-mysql</span></pre></div></div>

<p>ちなみにduplicatesディレクトリに入っているFomulaは、OS Xに標準で入っているものが集められています。</p>
<h3>MySQL5.1のインストール</h3>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">brew <span style="color: #c20cb9; font-weight: bold;">install</span> https:<span style="color: #000000; font-weight: bold;">//</span>raw.github.com<span style="color: #000000; font-weight: bold;">/</span>adamv<span style="color: #000000; font-weight: bold;">/</span>homebrew-alt<span style="color: #000000; font-weight: bold;">/</span>master<span style="color: #000000; font-weight: bold;">/</span>versions<span style="color: #000000; font-weight: bold;">/</span>mysql51.rb <span style="color: #660033;">--with-utf8-default</span> <span style="color: #660033;">--use-gcc</span></pre></div></div>

<h5>初期設定</h5>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">unset</span> TMPDIR
mysql_install_db</pre></div></div>

<h5>起動・停止</h5>
<p>私は、自動起動はさせたくなかったので、launchdには登録しませんでした。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mysql.server start
mysql.server stop</pre></div></div>

<h3>Apache2.2のインストール</h3>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">brew <span style="color: #c20cb9; font-weight: bold;">install</span> https:<span style="color: #000000; font-weight: bold;">//</span>raw.github.com<span style="color: #000000; font-weight: bold;">/</span>adamv<span style="color: #000000; font-weight: bold;">/</span>homebrew-alt<span style="color: #000000; font-weight: bold;">/</span>master<span style="color: #000000; font-weight: bold;">/</span>duplicates<span style="color: #000000; font-weight: bold;">/</span>httpd.rb</pre></div></div>

<p>httpd.conf等は/usr/local/Cellar/httpd/2.2.21/etc/apache2にあります。</p>
<h5>PHPなどの設定</h5>
<p>私の場合は、extra/php.confを作成し、httpd.confにてIncludeするようにしています。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>Cellar<span style="color: #000000; font-weight: bold;">/</span>httpd<span style="color: #000000; font-weight: bold;">/</span>2.2.21<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>extra<span style="color: #000000; font-weight: bold;">/</span>php.conf</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">LoadModule php5_module <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>Cellar<span style="color: #000000; font-weight: bold;">/</span>php<span style="color: #000000; font-weight: bold;">/</span>5.3.8<span style="color: #000000; font-weight: bold;">/</span>libexec<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>libphp5.so
AddType application<span style="color: #000000; font-weight: bold;">/</span>x-httpd-php .php .php5 .phtml</pre></div></div>

<p>その他に、DocumentRootを/Users/dataich/Sitesという風にユーザーホームのSitesディレクトリを使用するようにしました。この辺りはお好みで。</p>
<h5>起動・停止</h5>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> apachectl start
<span style="color: #c20cb9; font-weight: bold;">sudo</span> apachectl stop</pre></div></div>

<p>あとは、phpinfo()で出力してみたりして確認すればOKです。</p>
<p><strong>追記 &#8211; 2011/11/08</strong><br />
Homebrewで入れたPHPのpearでpermissionエラーが出ましたので、下記でもろもろ設定しました。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #660033;">-R</span> ug+<span style="color: #c20cb9; font-weight: bold;">w</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>Cellar<span style="color: #000000; font-weight: bold;">/</span>php<span style="color: #000000; font-weight: bold;">/</span>5.3.8<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>php
pear config-set php_ini <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php.ini</pre></div></div>

<div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://blog.dataich.com/2011/11/01/install-apache2-2-mysql5-1php5-3-using-homebrew/&via=dataich&text=HomebrewでApache2.2+MySQL5.1+PHP5.3環境を構築 &related=:&lang=en&count=vertical" class="twitter-share-button" onclick="pageTracker._trackPageview('/outgoing/twitter.com/share?url=http_//blog.dataich.com/2011/11/01/install-apache2-2-mysql5-1php5-3-using-homebrew/_via=dataich_text=Homebrew_Apache2.2+MySQL5.1+PHP5.3_related=_lang=en_count=vertical&amp;referer=');">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.dataich.com/2011/11/01/install-apache2-2-mysql5-1php5-3-using-homebrew/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CORESERVERからdotCloudにWordPressをお引っ越し</title>
		<link>http://blog.dataich.com/2011/08/02/wordpress-on-coreserver-to-dotcloud/</link>
		<comments>http://blog.dataich.com/2011/08/02/wordpress-on-coreserver-to-dotcloud/#comments</comments>
		<pubDate>Tue, 02 Aug 2011 13:03:48 +0000</pubDate>
		<dc:creator>dataich</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[dotCloud]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://blog.dataich.com/?p=1039</guid>
		<description><![CDATA[dotCloudがプライベートベータから正式リリースに至り、ベータの頃からのユーザには1年間のProアカウントを発行してくれるということで、PaaSの運用テストを兼ねて、引っ越してみることにしました。個人ではお高いのでず [...]]]></description>
			<content:encoded><![CDATA[<p>dotCloudがプライベートベータから正式リリースに至り、ベータの頃からのユーザには1年間のProアカウントを発行してくれるということで、PaaSの運用テストを兼ねて、引っ越してみることにしました。個人ではお高いのでずっとは使えませんが。。。</p>
<h3>CORESERVERでやること</h3>
<p>まずは、CORESERVER側のWordpressを本体、プラグインともに最新にアップデートしました。<br />
この状態でCORESERVERの管理画面からWordpressデータベースのダンプを取ってローカルに持ってきます。<br />
また、CORESERVER上のWordpressディレクトリもごっそりローカルに持ってきました。</p>
<h3>dotCloud基本設定</h3>
<p>ここからがdotCloudに対して行う作業です。<br />
ここではアプリケーション名をwordpressとしています。</p>
<p>dotCloudにアプリケーションを作成します。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dataich:dev dataich$ dotcloud create wordpress
Created application <span style="color: #ff0000;">&quot;wordpress&quot;</span></pre></div></div>

<p>ローカルにディレクトリを作成します。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dataich:dev dataich$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> blog.dataich.com</pre></div></div>

<p>ここにサービスの設定や、ソースコード等を置いていきます。</p>
<p>WordPressに必要なサービスPHP、MySQLの設定を行います。dotcloud.ymlに記述します。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dataich:dev dataich$ <span style="color: #c20cb9; font-weight: bold;">vi</span> blog.dataich.com<span style="color: #000000; font-weight: bold;">/</span>dotcloud.yml</pre></div></div>

<p><script type="text/javascript" src="https://gist.github.com/1119565.js?file=dotcloud.yml"></script></p>
<p>まずはこの状態で動きを確認してみます。 dotcloud pushコマンドでアプリケーションのソースコード（とはいってもこの段階ではdotcloud.ymlのみ）をPushします。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dataich:dev dataich$ dotcloud push wordpress blog.dataich.com
<span style="color: #666666; font-style: italic;"># upload blog.dataich.com ssh://dotcloud@uploader.dotcloud.com:21122/wordpress</span>
<span style="color: #666666; font-style: italic;"># rsync</span>
Pseudo-terminal will not be allocated because stdin is not a terminal.
Warning: Permanently added <span style="color: #ff0000;">'[uploader.dotcloud.com]:21122,[184.73.14.49]:21122'</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>RSA<span style="color: #7a0874; font-weight: bold;">&#41;</span> to the list of known hosts.
building <span style="color: #c20cb9; font-weight: bold;">file</span> list ... <span style="color: #000000; font-weight: bold;">done</span>
.<span style="color: #000000; font-weight: bold;">/</span>
dotcloud.yml
&nbsp;
sent <span style="color: #000000;">188</span> bytes  received <span style="color: #000000;">54</span> bytes  <span style="color: #000000;">9.88</span> bytes<span style="color: #000000; font-weight: bold;">/</span>sec
total <span style="color: #c20cb9; font-weight: bold;">size</span> is <span style="color: #000000;">52</span>  speedup is <span style="color: #000000;">0.21</span>
Deployment <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #ff0000;">&quot;wordpress&quot;</span> triggered. Will be available <span style="color: #000000; font-weight: bold;">in</span> a few seconds.
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:04:<span style="color: #000000;">54</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>api<span style="color: #7a0874; font-weight: bold;">&#93;</span> Waiting <span style="color: #000000; font-weight: bold;">for</span> the build. <span style="color: #7a0874; font-weight: bold;">&#40;</span>It may take a few minutes<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:04:<span style="color: #000000;">54</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> Deploying...
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:04:<span style="color: #000000;">54</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>data.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> Deploying...
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">25</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> Service booted
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">35</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>data.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> Service booted
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">35</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>api<span style="color: #7a0874; font-weight: bold;">&#93;</span> All the services are ready. Beginning the build.
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">36</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>data.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> The build started
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">36</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>data.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> This service <span style="color: #7a0874; font-weight: bold;">type</span> does not support build method, ignoring...
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">36</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>data.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> The build finished successfully
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">36</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> The build started
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">36</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> Fetched code revision rsync-<span style="color: #000000;">1312214692.31</span>
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">37</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> Updating channel <span style="color: #ff0000;">&quot;doc.php.net&quot;</span>
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">37</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> Update of Channel <span style="color: #ff0000;">&quot;doc.php.net&quot;</span> succeeded
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">37</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> Updating channel <span style="color: #ff0000;">&quot;pear.php.net&quot;</span>
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">38</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> Channel <span style="color: #ff0000;">&quot;pear.php.net&quot;</span> is up to <span style="color: #c20cb9; font-weight: bold;">date</span>
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">38</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> Updating channel <span style="color: #ff0000;">&quot;pecl.php.net&quot;</span>
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">38</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> Update of Channel <span style="color: #ff0000;">&quot;pecl.php.net&quot;</span> succeeded
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">38</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> -su: line <span style="color: #000000;">0</span>: <span style="color: #7a0874; font-weight: bold;">cd</span>: current: No such <span style="color: #c20cb9; font-weight: bold;">file</span> or directory
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">39</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> -su: line <span style="color: #000000;">0</span>: <span style="color: #7a0874; font-weight: bold;">cd</span>: current: No such <span style="color: #c20cb9; font-weight: bold;">file</span> or directory
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">39</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> Reloading nginx configuration: nginx.
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">42</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> php5-fpm: stopped
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">42</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> php5-fpm: ERROR <span style="color: #7a0874; font-weight: bold;">&#40;</span>abnormal termination<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">42</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>www.0<span style="color: #7a0874; font-weight: bold;">&#93;</span> The build finished successfully
<span style="color: #000000;">2011</span>-08-01 <span style="color: #000000;">23</span>:05:<span style="color: #000000;">42</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>api<span style="color: #7a0874; font-weight: bold;">&#93;</span> Deploy finished
&nbsp;
Deployment finished. Your application is available at the following URLs
www: http:<span style="color: #000000; font-weight: bold;">//</span>xxxxxxxx.dotcloud.com<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>最後の行にサービスwww（PHP）のURLが発行されているので、アクセスしてみます。当然何のリソースもPushしていないので、404が返ってくるかと思います。</p>
<h3>データの移行</h3>
<p>CORESERVERからとったデータベースダンプをdotCloud上のMySQLにロードします。そのためにdotCloudにデータベース、ユーザの作成をしておきます。</p>
<p>まずは、dotcloud infoでMySQLサービスの情報を取得します。ここでは書きませんが、rootパスワードその他情報が表示されるはずです。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dataich:dev dataich$ dotcloud info wordpress.data</pre></div></div>

<p>次のコマンドでMySQLのシェルにログインします。</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;">dataich:dev dataich$ dotcloud run wordpress.<span style="color: #990099; font-weight: bold;">data</span> <span style="color: #808080; font-style: italic;">-- mysql -u root -p</span>
<span style="color: #808080; font-style: italic;"># mysql -u root -p</span>
Warning: Permanently added <span style="color: #008000;">'[xxxxxxxx.dotcloud.com]:12428,[174.129.17.131]:12428'</span> <span style="color: #FF00FF;">&#40;</span>RSA<span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">to</span> the list of known hosts.
Enter <span style="color: #000099;">password</span>:
Welcome <span style="color: #990099; font-weight: bold;">to</span> the MySQL monitor.  Commands <span style="color: #009900;">end</span> <span style="color: #990099; font-weight: bold;">with</span> <span style="color: #000033;">;</span> <span style="color: #CC0099; font-weight: bold;">or</span> \g.
Your MySQL <span style="color: #FF9900; font-weight: bold;">connection</span> id <span style="color: #CC0099; font-weight: bold;">is</span> <span style="color: #008080;">34</span>
Server <span style="color: #000099;">version</span>: 5.1.41<span style="color: #CC0099;">-</span>3ubuntu12.10<span style="color: #CC0099;">-</span><span style="color: #000099;">log</span> <span style="color: #FF00FF;">&#40;</span>Ubuntu<span style="color: #FF00FF;">&#41;</span>
&nbsp;
<span style="color: #990099; font-weight: bold;">Type</span> <span style="color: #008000;">'help;'</span> <span style="color: #CC0099; font-weight: bold;">or</span> <span style="color: #008000;">'<span style="color: #004000; font-weight: bold;">\h</span>'</span> for <span style="color: #990099; font-weight: bold;">help</span>. <span style="color: #990099; font-weight: bold;">Type</span> <span style="color: #008000;">'<span style="color: #004000; font-weight: bold;">\c</span>'</span> <span style="color: #990099; font-weight: bold;">to</span> clear the current input statement.
&nbsp;
mysql<span style="color: #CC0099;">&gt;</span></pre></div></div>

<p>DBを作成します。</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;">CREATE</span> <span style="color: #990099; font-weight: bold;">DATABASE</span> wordpress<span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> <span style="color: #008080;">1</span> row affected <span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">0.00</span> sec<span style="color: #FF00FF;">&#41;</span></pre></div></div>

<p>ユーザを作成し、権限を与えます。</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;">GRANT</span> <span style="color: #990099; font-weight: bold;">ALL</span> <span style="color: #990099; font-weight: bold;">ON</span> wordpress.<span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">TO</span> <span style="color: #008000;">'dataich'</span>@<span style="color: #008000;">'<span style="color: #008080; font-weight: bold;">%</span>'</span> IDENTIFIED BY <span style="color: #008000;">'XXXXXXXXXX'</span><span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> <span style="color: #008080;">0</span> rows affected <span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">0.00</span> sec<span style="color: #FF00FF;">&#41;</span></pre></div></div>

<p>念のため</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;">mysql<span style="color: #CC0099;">&gt;</span> FLUSH <span style="color: #990099; font-weight: bold;">PRIVILEGES</span><span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> <span style="color: #008080;">0</span> rows affected <span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">0.00</span> sec<span style="color: #FF00FF;">&#41;</span></pre></div></div>

<p>では、データをロードします。 データをアップし</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dataich:dev dataich$ dotcloud run wordpress.data <span style="color: #ff0000;">&quot;cat &gt; data.sql&quot;</span> <span style="color: #000000; font-weight: bold;">&lt;</span> ~<span style="color: #000000; font-weight: bold;">/</span>Desktop<span style="color: #000000; font-weight: bold;">/</span>mysql_wp.dump
<span style="color: #666666; font-style: italic;"># cat &gt; data.sql</span>
Pseudo-terminal will not be allocated because stdin is not a terminal.
Warning: Permanently added <span style="color: #ff0000;">'[xxxxxxxx.dotcloud.com]:12428,[174.129.17.131]:12428'</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>RSA<span style="color: #7a0874; font-weight: bold;">&#41;</span> to the list of known hosts.</pre></div></div>

<p>SSHログインし</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dataich:dev dataich$ dotcloud <span style="color: #c20cb9; font-weight: bold;">ssh</span> wordpress.data
<span style="color: #666666; font-style: italic;"># $SHELL</span>
Warning: Permanently added <span style="color: #ff0000;">'[xxxxxxxx.dotcloud.com]:12428,[174.129.17.131]:12428'</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>RSA<span style="color: #7a0874; font-weight: bold;">&#41;</span> to the list of known hosts.
mysql<span style="color: #000000; font-weight: bold;">@</span>wordpress-default-data-<span style="color: #000000;">0</span>:~$</pre></div></div>

<p>ロードします。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mysql<span style="color: #000000; font-weight: bold;">@</span>wordpress-default-data-<span style="color: #000000;">0</span>:~$ mysql <span style="color: #660033;">-u</span> dataich <span style="color: #660033;">-p</span> wordpress <span style="color: #000000; font-weight: bold;">&lt;</span> data.sql</pre></div></div>

<h3>WordPressソースの移行</h3>
<p>アプリケーションのディレクトリにwwwというディレクトリを作り、そこにCORESEVERから持ってきたソースを置きます。</p>
<p>DBの設定を行うため、wp-config.phpを編集します。<br />
dotcloudでは/home/dotcloud/environment.jsonに各種サービスの設定が書かれます。それを読むようにしてあげればOKです。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dataich:dev dataich$ <span style="color: #c20cb9; font-weight: bold;">vi</span> blog.dataich.com<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>wp-config.php</pre></div></div>

<p><script src="https://gist.github.com/1119568.js?file=wp-config.php"></script></p>
<h3>nginxの設定</h3>
<p>パーマリンク設定をp=123の形から変えている場合は、nginxの設定が必要になります。それにはnginx.confを置いてあげればOKです。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dataich:dev dataich$ <span style="color: #c20cb9; font-weight: bold;">vi</span> blog.dataich.com<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>nginx.conf</pre></div></div>

<p><script type="text/javascript" src="https://gist.github.com/1119570.js?file=nginx.conf"></script></p>
<h3>wp-contentディレクトリの扱い</h3>
<p>このままだと1回目以降にPushした際にwp-content以下が消えてしまいます。それではまずいので、すでにwp-contentディレクトリが存在する場合は何もしないようにpostinstallスクリプトを書いておきます。（dotcloudのヘルプそのまんま）</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dataich:dev dataich$ <span style="color: #c20cb9; font-weight: bold;">vi</span> blog.dataich.com<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>postinstall</pre></div></div>

<p><script src="https://gist.github.com/1119572.js?file=postinstall"></script></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dataich:dev dataich$ <span style="color: #c20cb9; font-weight: bold;">chmod</span> +x blog.dataich.com<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>postinstall</pre></div></div>

<h3>dotCloudへWordpressソースをPush</h3>
<p>これで、動くはず！さあ、Push!!!</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dataich:dev dataich$ dotcloud push wordpress blog.dataich.com
<span style="color: #666666; font-style: italic;"># upload blog.dataich.com ssh://dotcloud@uploader.dotcloud.com:21122/wordpress</span>
<span style="color: #666666; font-style: italic;"># rsync</span>
Pseudo-terminal will not be allocated because stdin is not a terminal.
Warning: Permanently added <span style="color: #ff0000;">'[uploader.dotcloud.com]:21122,[184.73.14.49]:21122'</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>RSA<span style="color: #7a0874; font-weight: bold;">&#41;</span> to the list of known hosts.
building <span style="color: #c20cb9; font-weight: bold;">file</span> list ... <span style="color: #000000; font-weight: bold;">done</span>
.<span style="color: #000000; font-weight: bold;">/</span>
www<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;
..
..
..
&nbsp;
www: http:<span style="color: #000000; font-weight: bold;">//</span>xxxxxxxx.dotcloud.com<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>上記、URLに正しくアクセスできました。</p>
<h3>カスタムドメインの設定</h3>
<p>まずはdotCloud側を設定します。aliasコマンドを使います。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dataich:~ dataich$ dotcloud <span style="color: #7a0874; font-weight: bold;">alias</span> add wordpress.www blog.dataich.com
Ok. Now please add the following DNS record:
blog.dataich.com. IN CNAME gateway.dotcloud.com.</pre></div></div>

<p>CNAMEでgateway.dotcloud.com.を設定するように言われるので、VALUE-DOMAIN側のドメイン設定を行います。</p>
<p>http://blog.dataich.com/</p>
<p>上記にアクセスし、動作確認。無事当ブログをdotCloudで動かすことに成功しました。<br />
ざっと確認したところ問題なし。これで暫く運用テストしてみます。</p>
<p>ここまでやっといてアレなのですが、そう負荷のない個人ブログを運用するにはちょっとお値段が辛いです。<br />
もう少しリーズナブルなプランがあればいいのですが。。</p>
<div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://blog.dataich.com/2011/08/02/wordpress-on-coreserver-to-dotcloud/&via=dataich&text=CORESERVERからdotCloudにWordpressをお引っ越し&related=:&lang=en&count=vertical" class="twitter-share-button" onclick="pageTracker._trackPageview('/outgoing/twitter.com/share?url=http_//blog.dataich.com/2011/08/02/wordpress-on-coreserver-to-dotcloud/_via=dataich_text=CORESERVER_dotCloud_Wordpress_related=_lang=en_count=vertical&amp;referer=');">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.dataich.com/2011/08/02/wordpress-on-coreserver-to-dotcloud/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysqldumpでのBLOB項目</title>
		<link>http://blog.dataich.com/2008/03/19/mysqldump%e3%81%a7%e3%81%aeblob%e9%a0%85%e7%9b%ae/</link>
		<comments>http://blog.dataich.com/2008/03/19/mysqldump%e3%81%a7%e3%81%aeblob%e9%a0%85%e7%9b%ae/#comments</comments>
		<pubDate>Wed, 19 Mar 2008 00:55:00 +0000</pubDate>
		<dc:creator>dataich</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://dataich.s15.coreserver.jp/blog/2008/03/19/mysqldump%e3%81%a7%e3%81%aeblob%e9%a0%85%e7%9b%ae/</guid>
		<description><![CDATA[mysqldumpに&#8211;hex-blobオプションをつけてやることで、BLOBカラムがHEX出力される。 mysqldump --hex-blob -u ユーザ -p データベース名 &#62; 出力ファイルパス [...]]]></description>
			<content:encoded><![CDATA[<p>mysqldumpに&#8211;hex-blobオプションをつけてやることで、BLOBカラムがHEX出力される。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mysqldump <span style="color: #660033;">--hex-blob</span> <span style="color: #660033;">-u</span> ユーザ <span style="color: #660033;">-p</span> データベース名 <span style="color: #000000; font-weight: bold;">&gt;</span> 出力ファイルパス</pre></div></div>

<div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://blog.dataich.com/2008/03/19/mysqldump%e3%81%a7%e3%81%aeblob%e9%a0%85%e7%9b%ae/&via=dataich&text=mysqldumpでのBLOB項目&related=:&lang=en&count=vertical" class="twitter-share-button" onclick="pageTracker._trackPageview('/outgoing/twitter.com/share?url=http_//blog.dataich.com/2008/03/19/mysqldump_e3_81_a7_e3_81_aeblob_e9_a0_85_e7_9b_ae/_via=dataich_text=mysqldump_BLOB_related=_lang=en_count=vertical&amp;referer=');">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.dataich.com/2008/03/19/mysqldump%e3%81%a7%e3%81%aeblob%e9%a0%85%e7%9b%ae/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL CSVインポート</title>
		<link>http://blog.dataich.com/2008/03/04/mysql-csv%e3%82%a4%e3%83%b3%e3%83%9d%e3%83%bc%e3%83%88/</link>
		<comments>http://blog.dataich.com/2008/03/04/mysql-csv%e3%82%a4%e3%83%b3%e3%83%9d%e3%83%bc%e3%83%88/#comments</comments>
		<pubDate>Tue, 04 Mar 2008 07:51:00 +0000</pubDate>
		<dc:creator>dataich</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://dataich.s15.coreserver.jp/blog/2008/03/04/mysql-csv%e3%82%a4%e3%83%b3%e3%83%9d%e3%83%bc%e3%83%88/</guid>
		<description><![CDATA[load data local infile &#34;CSVファイルパス&#34; into table テーブル名 fields terminated by ','; Tweet]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">load data <span style="color: #7a0874; font-weight: bold;">local</span> infile <span style="color: #ff0000;">&quot;CSVファイルパス&quot;</span> into table テーブル名 fields terminated by <span style="color: #ff0000;">','</span>;</pre></div></div>

<div style="float: right; margin-left: 10px;"><a href="http://twitter.com/share?url=http://blog.dataich.com/2008/03/04/mysql-csv%e3%82%a4%e3%83%b3%e3%83%9d%e3%83%bc%e3%83%88/&via=dataich&text=MySQL CSVインポート&related=:&lang=en&count=vertical" class="twitter-share-button" onclick="pageTracker._trackPageview('/outgoing/twitter.com/share?url=http_//blog.dataich.com/2008/03/04/mysql-csv_e3_82_a4_e3_83_b3_e3_83_9d_e3_83_bc_e3_83_88/_via=dataich_text=MySQL_CSV_related=_lang=en_count=vertical&amp;referer=');">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></div>]]></content:encoded>
			<wfw:commentRss>http://blog.dataich.com/2008/03/04/mysql-csv%e3%82%a4%e3%83%b3%e3%83%9d%e3%83%bc%e3%83%88/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

