<?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>Dream Seed &#187; MySQL</title>
	<atom:link href="http://www.dream-seed.com/weblog/archives/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dream-seed.com/weblog</link>
	<description>スマートフォンとかパソコンとかレザークラフトとか好きなことをだらだら書くブログ</description>
	<lastBuildDate>Fri, 10 Feb 2012 02:54:59 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>WordPressの高速化</title>
		<link>http://www.dream-seed.com/weblog/archives/2010/07/9472/</link>
		<comments>http://www.dream-seed.com/weblog/archives/2010/07/9472/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 03:21:52 +0000</pubDate>
		<dc:creator>tatsuya</dc:creator>
				<category><![CDATA[雑記]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.dream-seed.com/weblog/?p=9472</guid>
		<description><![CDATA[<a href="http://www.dream-seed.com/weblog/archives/2010/07/9472/"><img align="left" hspace="5" width="200" src="" class="alignleft wp-post-image tfe" alt="" title="" /></a>ここ最近、このサイトの表示が異常に重くなることがあったので、思いきってWordpressの高速化にチャレンジしてみました。 参考にしたのは、こちらの「WordPress を高速化する5つの方法」という… <p class="readmore"><a href="http://www.dream-seed.com/weblog/archives/2010/07/9472/" id="readmore">この記事の続きを読む</a></p>]]></description>
			<content:encoded><![CDATA[<p>ここ最近、このサイトの表示が異常に重くなることがあったので、思いきってWordpressの高速化にチャレンジしてみました。</p>
<p>参考にしたのは、<a href="http://www.syuhari.jp/blog/archives/382">こちらの「WordPress を高速化する5つの方法」</a>という記事。</p>
<p>まず、MySQLのテーブルを最適化してオーバヘッドを解消（これはphpMyAdminから実行）。次に、クエリキャッシュの有効化。これも、リンク先にある<a href="http://logic.stepserver.jp/data/archives/465.html">クエリ結果のキャッシュ</a>を参考に実施。</p>
<p>PHPの高速化はAPCを有効にしてみることに。ここで軽くはまりました。参考にしたのは、こちらの「<a href="http://www.doyouphp.jp/tips/tips_apc.shtml">APC（Alternative PHP Cache）再び </a>」。まず、</p>
<pre class="brush: bash; title: ; notranslate"># pecl install APC</pre>
<p>をしてみると、phpizeでエラーが出るので確認したら、phpizeコマンド自体が存在しませんでした…。なもんで、phpizeが入っているPHPの開発パッケージをインストールするために、</p>
<pre class="brush: bash; title: ; notranslate"># apt-get install php-devel</pre>
<p>を実行（この際BINDやapacheなどのアップデートも一緒に実行し間接的に<a href="http://www.dream-seed.com/weblog/archives/2010/07/%E6%98%A8%E6%97%A5%E4%B8%80%E6%97%A5%E3%80%81%E3%81%93%E3%81%AE%E3%82%B5%E3%82%A4%E3%83%88%E3%81%8C%E8%A6%8B%E3%82%8C%E3%81%AA%E3%81%8B%E3%81%A3%E3%81%9F%E3%81%A8%E6%80%9D%E3%81%84%E3%81%BE%E3%81%99/">昨日のトラブル</a>の原因となっていました）。php-devel（phpize）をインストール後は、先のpeclコマンドがそのまま通りました。それからphp.iniの最後に、</p>
<pre class="brush: bash; title: ; notranslate">                  :
extension=apc.so
                  :</pre>
<p>を追加して、apacheを再起動。</p>
<p>なんとなく早くなった気はしますが、気の性と言われるとそんな気もするレベルかな？根本的にはサーバをスペックアップアップしなくちゃいけないんだろうけど（いまのサーバは<a href="http://www.dream-seed.com/weblog/archives/2009/05/%E8%87%AA%E5%AE%85%E3%82%B5%E3%83%BC%E3%83%90%E3%80%80eeepc%E3%81%B8%E3%81%AE%E7%A7%BB%E8%A1%8C%E5%AE%8C%E4%BA%86/">eeePC901-X</a>）。自宅に19インチラックを置いて、1UのサーバやL3スイッチを弄り倒したいけど、お金も場所も厳しいです…。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dream-seed.com/weblog/archives/2010/07/9472/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQLのテーブル破損</title>
		<link>http://www.dream-seed.com/weblog/archives/2010/04/9197/</link>
		<comments>http://www.dream-seed.com/weblog/archives/2010/04/9197/#comments</comments>
		<pubDate>Sun, 11 Apr 2010 12:34:21 +0000</pubDate>
		<dc:creator>tatsuya</dc:creator>
				<category><![CDATA[雑記]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PC]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.dream-seed.com/weblog/?p=9197</guid>
		<description><![CDATA[<a href="http://www.dream-seed.com/weblog/archives/2010/04/9197/"><img align="left" hspace="5" width="200" src="" class="alignleft wp-post-image tfe" alt="" title="" /></a>今日の昼過ぎくらいですが、このBlogが「データベースエラー」で閲覧できない状態でした。 MySQLでエラーが起きているということはすぐにわかったので、サーバからmysqlcheckをかけて見るとwo… <p class="readmore"><a href="http://www.dream-seed.com/weblog/archives/2010/04/9197/" id="readmore">この記事の続きを読む</a></p>]]></description>
			<content:encoded><![CDATA[<p>今日の昼過ぎくらいですが、このBlogが「データベースエラー」で閲覧できない状態でした。</p>
<p>MySQLでエラーが起きているということはすぐにわかったので、サーバからmysqlcheckをかけて見るとwordpressのDBのチェックが途中で止まる…。とりあえずいったんMySQLを落として再起動してみるかと思い、試してみたら落とせない。で、気が付いたらmysqlコマンドでもアクセス出来なくなってしまいました。これはサーバを再起動しても変わらず。初期化して再構築かなぁなんて思いがよぎりましたが、よくよく調べてみるとサーバのルートパーテションが使用量100%で空きがない。あわてて不要なファイルを削除し、使用量が80%くらいにして再起動したらMySQLが動きました。checkコマンドでwp_optionsが壊れていたのでrepairコマンドで修復。この状態でなぜかルートパーテションの使用量は30%になっていました…。う～ん、謎だ。wp_optionsが壊れたのが原因でmysqlのログが肥大化→ルートを圧迫ってことなのか？そういえば今回はMySQLのログを確認しなかったな…。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dream-seed.com/weblog/archives/2010/04/9197/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>E90で動くApache,MySQL,PHP</title>
		<link>http://www.dream-seed.com/weblog/archives/2007/11/5711/</link>
		<comments>http://www.dream-seed.com/weblog/archives/2007/11/5711/#comments</comments>
		<pubDate>Sat, 17 Nov 2007 13:17:47 +0000</pubDate>
		<dc:creator>tatsuya</dc:creator>
				<category><![CDATA[レビュー]]></category>
		<category><![CDATA["Symbian S60 3rd"]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[LAMP]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PAMP]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.dream-seed.com/wordpress/2007/11/e90apachemysqlp/</guid>
		<description><![CDATA[<a href="http://www.dream-seed.com/weblog/archives/2007/11/5711/"><img align="left" hspace="5" width="200" src="" class="alignleft wp-post-image tfe" alt="" title="" /></a>I can now reveal that we at the CCNC conference in Las Vegas in January, 2008 will demonstrate and r… <p class="readmore"><a href="http://www.dream-seed.com/weblog/archives/2007/11/5711/" id="readmore">この記事の続きを読む</a></p>]]></description>
			<content:encoded><![CDATA[<blockquote><p>I can now reveal that we at the CCNC conference in Las Vegas in January, 2008 will demonstrate and release what we call the PAMP stack.</p>
<p>PAMP stands for Personal Apache, MySQL, PHP, so yes, the full LAMP stack will be made available for S60 smart phones. In addition, there will be PHP extension modules that provide access to the core functionality of the phone. And on top of PAMP you can basically install any LAMP based content management system. For instance, Drupal can be installed off the shelf.</p>
<p>Yes, a fair amount of memory is needed and it&#8217;s still pretty experimental stuff, but it runs quite nicely on E90.</p>
<h4><a href="http://blogs.s60.com/mws/2007/11/hot_news_php_coming_to_s60.html">Hot news: PHP and MySQL coming to S60!</a></h4>
</blockquote>
<p><a href="http://my-e90.info/">NOKIA E90 Communicator</a>さんで知りましたが、S60で動くLAMP環境（PAMP:Personal Apache, MySQL, PHP）が来年1月にラスベガスで行われるCCNC conferenceで発表されるようです。Apacheが動いて、そのうえPHP、MySQLがE90上で動くとなれば、やれることが一気に広がりますね。Wikiをメモ帳代りにしたり、MySQLでDBを作ったり。来年1月は管理工学から<a href="http://www.kthree.co.jp/3work/work4_symbian_plusj.html">+J for S60</a>も出る予定なので、すごく待ち遠しいです。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dream-seed.com/weblog/archives/2007/11/5711/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MT4をMySQL3.23で無理やり動かす</title>
		<link>http://www.dream-seed.com/weblog/archives/2007/09/5585/</link>
		<comments>http://www.dream-seed.com/weblog/archives/2007/09/5585/#comments</comments>
		<pubDate>Thu, 13 Sep 2007 13:59:46 +0000</pubDate>
		<dc:creator>tatsuya</dc:creator>
				<category><![CDATA[雑記]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MovableType]]></category>
		<category><![CDATA[MT]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.dream-seed.com/wordpress/2007/09/mt4mysql323/</guid>
		<description><![CDATA[<a href="http://www.dream-seed.com/weblog/archives/2007/09/5585/"><img align="left" hspace="5" width="200" src="" class="alignleft wp-post-image tfe" alt="" title="" /></a>なんとか過去ログのURLも含めて復旧終了。過去ログは98％くらいは以前のままのURLになったと思います。 事の発端はデザインを変えた後の再構築。再構築をかけてもまったく終わる気配がない。っていうか再構… <p class="readmore"><a href="http://www.dream-seed.com/weblog/archives/2007/09/5585/" id="readmore">この記事の続きを読む</a></p>]]></description>
			<content:encoded><![CDATA[<p>なんとか過去ログのURLも含めて復旧終了。過去ログは98％くらいは以前のままのURLになったと思います。</p>
<p>事の発端はデザインを変えた後の再構築。再構築をかけてもまったく終わる気配がない。っていうか再構築されていない。一晩かけてもまったく終わらないのでいろいろいじってる内に完全におかしくなってしまったのでした（私が悪いんだけど）。</p>
<p>これとは別に、MT4に上げてから管理画面の記事一覧で、最初の20件は表示できるけど次の20件とかが表示できないという現象が発生していました。だけでもデフォルトの表示行数を100件とかにするとちゃんと表示できるのでDBが壊れているわけではなさそうだから、そのうち調べようと放置していました。</p>
<p>で、結果的には再構築できなかったのも記事一覧がちゃんと機能しなかったのも同じ原因でした。</p>
<p>再構築中のウィンドのソースを見ると、</p>
<pre id="command">
mt.cgi?__mode=rebuild&#038;blog_id=1&#038;type=index&#038;next=0&#038;offset=&#038;limit=～
</pre>
<p>という部分があり、このoffsetとlimitがあやしいんじゃないかとあたりをつけました。理由は、再構築したときも個別記事の最初の何件かはちゃんと再構築できていたから。</p>
<p>で、MovableTypeのソースからあやしそうな部分を探していったら、lib/MT/ObjectDriver/SQL.pmの263行目に</p>
<pre id="command">
return sprintf "LIMIT %d%s\n", $n,
          ($o ? " OFFSET " . int($o) : "");
</pre>
<p>という部分がありました。SELECTの条件となるOFFSETの値を返すSQLを発行しているようですが、このサイトで使っているMySQLの書式では、</p>
<pre id="command">
SELECT * FROM Table名 LIMIT offset値, 件数
</pre>
<p>だったはず（前にPHP＋MySQLでいろいろ作っていた時に調べました）。しかし上記の書き方では、</p>
<pre id="command">
SELECT * FROM Table名 LIMIT 件数 OFFSET offset値
</pre>
<p>になってしまいます。</p>
<p>で、さらに調べたところ、PostgreSQLでは後者の書式になっていて、MySQL4.0以降では互換性の為に後者の書式もサポートしているとのこと。そういえば、MovableType4の動作環境ってMySQL4.0以上でしたね。でもうちのMySQLは前に4.0.～に上げたはず・・・っと思って調べたら3.23.53でしたよ。あれ～？</p>
<p>いまさらMySQLのバージョンアップはメンドクサイので、SQL.pmの問題の個所を</p>
<pre id="command">
return sprintf "LIMIT %s%d\n",
          ($o ? int($o) ." , " : ""), $n;
</pre>
<p>と書き換えて、無理やり書式を合わせてみました。とりあえずこれでちゃんと動くようなりました。</p>
<p>だけども、MySQLをバージョンアップしたほうがいいんだろうなぁ。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dream-seed.com/weblog/archives/2007/09/5585/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  www.dream-seed.com/weblog/archives/tag/mysql/feed/ ) in 0.28859 seconds, on Feb 10th, 2012 at 5:45 am UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 10th, 2012 at 6:45 am UTC -->
