<?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/"
		xmlns:xhtml="http://www.w3.org/1999/xhtml"
>

<channel>
	<title>森の夢 &#187; mysql</title>
	<atom:link href="http://morinoyume.com/category/techs/server/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://morinoyume.com</link>
	<description>渋谷で働く若手ＳＥの日々の日記。</description>
	<lastBuildDate>Thu, 11 Feb 2010 05:10:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://morinoyume.com/category/techs/server/mysql/feed/" />
		<item>
		<title>mysqlパーティショニングのまとめ③- パフォーマンス</title>
		<link>http://morinoyume.com/techs/mysql%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%8b%e3%83%b3%e3%82%b0%e3%81%ae%e3%81%be%e3%81%a8%e3%82%81%e2%91%a2-%e3%83%91%e3%83%95%e3%82%a9%e3%83%bc%e3%83%9e%e3%83%b3%e3%82%b9/</link>
		<comments>http://morinoyume.com/techs/mysql%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%8b%e3%83%b3%e3%82%b0%e3%81%ae%e3%81%be%e3%81%a8%e3%82%81%e2%91%a2-%e3%83%91%e3%83%95%e3%82%a9%e3%83%bc%e3%83%9e%e3%83%b3%e3%82%b9/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 18:28:26 +0000</pubDate>
		<dc:creator>YSU</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[サーバー構築]]></category>
		<category><![CDATA[技術]]></category>
		<category><![CDATA[まとめ]]></category>

		<guid isPermaLink="false">http://morinoyume.com/?p=353</guid>
		<description><![CDATA[ mysqlパーティショニングのまとめ① - 設定・再コンパイル
 mysqlパーティショニングのまとめ② - パーティショニングのタイプ
mysqlパーティショニングのまとめ③ - パフォーマンス
さて、前回まではパー [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://morinoyume.com/techs/mysql%E3%83%91%E3%83%BC%E3%83%86%E3%82%A3%E3%82%B7%E3%83%A7%E3%83%8B%E3%83%B3%E3%82%B0%E3%81%AE%E3%81%BE%E3%81%A8%E3%82%81%E2%91%A0-%E8%A8%AD%E5%AE%9A%E3%83%BB%E5%86%8D%E3%82%B3%E3%83%B3%E3%83%91/"> mysqlパーティショニングのまとめ① - 設定・再コンパイル</a><br />
<a href="http://morinoyume.com/techs/mysql%E3%83%91%E3%83%BC%E3%83%86%E3%82%A3%E3%82%B7%E3%83%A7%E3%83%8B%E3%83%B3%E3%82%B0%E3%81%AE%E3%81%BE%E3%81%A8%E3%82%81%E2%91%A1-%E3%83%91%E3%83%BC%E3%83%86%E3%82%A3%E3%82%B7%E3%83%A7%E3%83%8B/"> mysqlパーティショニングのまとめ② - パーティショニングのタイプ</a><br />
mysqlパーティショニングのまとめ③ - パフォーマンス</p>
<p>さて、前回まではパーティショニングの設定やパーティショニングのタイプについて述べてきたが、<br />
ここからはパフォーマンスの話をしていく。</p>
<blockquote><p>サンプルテーブル</p></blockquote>
<p>まず、以下のサンプルテーブルを用意した。<br />
それぞれのテーブルに2倍にあたる245746件の郵政省のデータをいれてある。</p>
<p>・postal_normal</p>
<pre class="brush: plain;">
CREATE TABLE postal_normal (
  id int(10) unsigned NOT NULL AUTO_INCREMENT,
  `code` int(7) NOT NULL,
  ken_kana varchar(255) DEFAULT NULL,
  ctiy_kana varchar(255) DEFAULT NULL,
  town_kana varchar(255) DEFAULT NULL,
  ken varchar(255) DEFAULT NULL,
  citiy varchar(255) DEFAULT NULL,
  town varchar(255) DEFAULT NULL,
  flg1 tinyint(1) NOT NULL,
  flg2 tinyint(1) NOT NULL,
  flg3 tinyint(1) NOT NULL,
  flg4 tinyint(1) NOT NULL,
  flg5 tinyint(1) NOT NULL,
  flg6 tinyint(1) NOT NULL,
  entry timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (id),
  KEY town (town),
  KEY flg1 (flg1),
  KEY entry (entry),
  KEY `code` (`code`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
</pre>
<p>・postal_hash16</p>
<pre class="brush: plain;">
CREATE TABLE postal_hash16 (
  id int(10) unsigned NOT NULL AUTO_INCREMENT,
  `code` int(7) NOT NULL,
  ken_kana varchar(255) DEFAULT NULL,
  ctiy_kana varchar(255) DEFAULT NULL,
  town_kana varchar(255) DEFAULT NULL,
  ken varchar(255) DEFAULT NULL,
  citiy varchar(255) DEFAULT NULL,
  town varchar(255) DEFAULT NULL,
  flg1 tinyint(1) NOT NULL,
  flg2 tinyint(1) NOT NULL,
  flg3 tinyint(1) NOT NULL,
  flg4 tinyint(1) NOT NULL,
  flg5 tinyint(1) NOT NULL,
  flg6 tinyint(1) NOT NULL,
  entry timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (id),
  KEY town (town),
  KEY flg1 (flg1),
  KEY entry (entry),
  KEY `code` (`code`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8
PARTITION BY LINEAR HASH (id) PARTITIONS 16;
</pre>
<blockquote><p>テストケース</p></blockquote>
<p>上記のデータに対して、以下のテストを行う。</p>
<ul>
<li>id=240000で検索</li>
<li>id IN (240000, 240001, 240002, 240003, 240004, 240005, 240006, 240007)で検索</li>
<li>code=1000000で検索</li>
<li>ken LIKE '%北海道%'</li>
<li>１レコード追加</li>
</ul>
<blockquote><p>id=240000で検索</p></blockquote>
<p>・パーティショニング</p>
<pre class="brush: plain;">
select * from postal_hash16 where id = 240000;
1 row in set (0.02 sec)
</pre>
<p>・ノーマル</p>
<pre class="brush: plain;">
select * from postal_normal where id = 240000;
1 row in set (0.01 sec)
</pre>
<p>さすがに、パーティションしていないとはいえインデックスの効いたたかが24万件なので差はあまり無いと思われる。<br />
ただ、パーティションしてあるほうはたかだか1万ちょっとからの検索になるはずなので早いはずだが・・・</p>
<blockquote><p>id IN (240000, 240001, 240002, 240003, 240004, 240005, 240006, 240007)で検索</p></blockquote>
<p>・パーティショニング</p>
<pre class="brush: plain;">
select * from postal_hash16 where id IN (240000, 240001, 240002, 240003, 240004, 240005, 240006, 240007);
8 rows in set (0.00 sec);
</pre>
<p>・ノーマル</p>
<pre class="brush: plain;">
select * from postal_normal where id  IN (240000, 240001, 240002, 240003, 240004, 240005, 240006, 240007);
8 rows in set (0.00 sec)
</pre>
<p>うーん・・・検索件数を増やしてもスピードは変わらず・・・<br />
やはり24万件程度では差がでないということか。</p>
<blockquote><p>code=1000000で検索</p></blockquote>
<p>・パーティショニング</p>
<pre class="brush: plain;">
 select * from postal_hash16 where code = 1000000;
2 rows in set (0.26 sec)
</pre>
<p>・ノーマル</p>
<pre class="brush: plain;">
 select * from postal_normal where code = 1000000;
2 rows in set (0.03 sec)
</pre>
<p>これは違いがはっきり出た。<br />
やはりパーティションしているほうが遅いということである。この場合インデックスは効いていないのかも・・・。</p>
<blockquote><p>ken LIKE '%北海道%'で検索</p></blockquote>
<p>・パーティショニング</p>
<pre class="brush: plain;">
 select * from postal_hash16 where ken LIKE '%北海道%'
16454 rows in set (2.34 sec)
</pre>
<p>・ノーマル</p>
<pre class="brush: plain;">
 select * from postal_normal where ken LIKE '%北海道%'
16454 rows in set (1.74 sec)
</pre>
<p>なるほど、インデックスの効いていないカラムに対しては、<br />
ノーマルもやはり遅いが、やはりパーティショニングしている方が遅い結果になった。</p>
<blockquote><p>１レコード追加</p></blockquote>
<p>・パーティショニング</p>
<pre class="brush: plain;">
INSERT INTO `test2`.`postal_hash16` (`code`, `ken_kana`, `ctiy_kana`, `town_kana`, `ken`, `citiy`, `town`, `flg1`, `flg2`, `flg3`, `flg4`, `flg5`, `flg6`, `entry`) VALUES ( &quot;9071801&quot;,&quot;ｵｷﾅﾜｹﾝ&quot;,&quot;ﾔｴﾔﾏｸﾞﾝﾖﾅｸﾞﾆﾁﾖｳ&quot;,&quot;ﾖﾅｸﾞﾆ&quot;,&quot;沖縄県&quot;,&quot;八重山郡与那国町&quot;,&quot;与那国&quot;,0,0,0,0,0,0,NOW() );
Query OK, 1 row affected (0.04 sec)
</pre>
<p>・ノーマル</p>
<pre class="brush: plain;">
INSERT INTO `test2`.`postal_normal` (`code`, `ken_kana`, `ctiy_kana`, `town_kana`, `ken`, `citiy`, `town`, `flg1`, `flg2`, `flg3`, `flg4`, `flg5`, `flg6`, `entry`) VALUES ( &quot;9071801&quot;,&quot;ｵｷﾅﾜｹﾝ&quot;,&quot;ﾔｴﾔﾏｸﾞﾝﾖﾅｸﾞﾆﾁﾖｳ&quot;,&quot;ﾖﾅｸﾞﾆ&quot;,&quot;沖縄県&quot;,&quot;八重山郡与那国町&quot;,&quot;与那国&quot;,0,0,0,0,0,0,NOW() );
Query OK, 1 row affected (0.02 sec)
</pre>
<p>パーティショニングを計算してインサートする分どうしても遅くなってしまう。</p>
<blockquote><p>まとめ</p></blockquote>
<p>今回の実験結果では、パーティショニングのキーとなったプライマリキーの検索ではパフォーマンスは同じであったが、<br />
それ以外のカラムの検索ではパフォーマンスが大きく低下してしまう結果になった。<br />
ただし、24万件ではなく、100万件、1000万件レベルのテストになるとパーティショニングした場合のプライマリキーでの検索に効果が見られる可能性はある。</p>
<p>現時点では他のカラムの検索や、インサートなどのパフォーマンスが劇的に落ちてしまうため、24万レコードレベルのテーブルではパーティショニングは導入すべきでないと考える。</p>
<p>もし、使用するとなれば、アクセスログやクエリーログをテーブル化し、データ量がそれこそ何千万件となったときに効果を発揮するのかもしれない。<br />
是非、大容量のデータでテストをしてみたいが、なんせインサートが遅いのとマシンのスペックが追いつかないため今回は見送らせていただく。</p>
<p>実は仕事でパーティショニングを使ってみたかったが、今回のパフォーマンスではなかなか難しそうだなぁ～</p>
<h3  class="related_post_title">関連の記事</h3><ul class="related_post"><li>2009 年 12 月 8 日 -- <a href="http://morinoyume.com/techs/mysql%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%8b%e3%83%b3%e3%82%b0%e3%81%ae%e3%81%be%e3%81%a8%e3%82%81%e2%91%a1-%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%8b/" title="mysqlパーティショニングのまとめ② &#8211; パーティショニングのタイプ">mysqlパーティショニングのまとめ② &#8211; パーティショニングのタイプ</a></li><li>2009 年 12 月 8 日 -- <a href="http://morinoyume.com/techs/mysql%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%8b%e3%83%b3%e3%82%b0%e3%81%ae%e3%81%be%e3%81%a8%e3%82%81%e2%91%a0-%e8%a8%ad%e5%ae%9a%e3%83%bb%e5%86%8d%e3%82%b3%e3%83%b3%e3%83%91/" title="mysqlパーティショニングのまとめ① &#8211; 設定・再コンパイル">mysqlパーティショニングのまとめ① &#8211; 設定・再コンパイル</a></li><li>2010 年 1 月 17 日 -- <a href="http://morinoyume.com/others/2010%e5%b9%b4%e3%81%ae%e7%9b%ae%e6%a8%99%ef%bc%81%ef%bc%81/" title="2010年の目標！！">2010年の目標！！</a></li><li>2009 年 11 月 29 日 -- <a href="http://morinoyume.com/techs/phpmyadmin%e3%81%a7%e3%82%a8%e3%83%a9%e3%83%bc%e3%81%af%e3%81%aa%e3%81%84%e3%81%8c%e3%83%ad%e3%82%b0%e3%82%a4%e3%83%b3%e3%81%a7%e3%81%8d%e3%81%aa%e3%81%84%e7%8f%be%e8%b1%a1%e3%81%ab%e3%81%a4%e3%81%84/" title="phpMyAdminでエラーはないがログインできない現象について">phpMyAdminでエラーはないがログインできない現象について</a></li><li>2009 年 11 月 28 日 -- <a href="http://morinoyume.com/techs/symfony%e3%81%a7%e3%81%be%e3%81%9a%e3%81%af%e3%83%97%e3%83%ad%e3%82%b8%e3%82%a7%e3%82%af%e3%83%88%e4%bd%9c%e6%88%90/" title="symfonyでまずはプロジェクト作成">symfonyでまずはプロジェクト作成</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://morinoyume.com/techs/mysql%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%8b%e3%83%b3%e3%82%b0%e3%81%ae%e3%81%be%e3%81%a8%e3%82%81%e2%91%a2-%e3%83%91%e3%83%95%e3%82%a9%e3%83%bc%e3%83%9e%e3%83%b3%e3%82%b9/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://morinoyume.com/techs/mysql%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%8b%e3%83%b3%e3%82%b0%e3%81%ae%e3%81%be%e3%81%a8%e3%82%81%e2%91%a2-%e3%83%91%e3%83%95%e3%82%a9%e3%83%bc%e3%83%9e%e3%83%b3%e3%82%b9/" />
	</item>
		<item>
		<title>mysqlパーティショニングのまとめ② &#8211; パーティショニングのタイプ</title>
		<link>http://morinoyume.com/techs/mysql%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%8b%e3%83%b3%e3%82%b0%e3%81%ae%e3%81%be%e3%81%a8%e3%82%81%e2%91%a1-%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%8b/</link>
		<comments>http://morinoyume.com/techs/mysql%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%8b%e3%83%b3%e3%82%b0%e3%81%ae%e3%81%be%e3%81%a8%e3%82%81%e2%91%a1-%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%8b/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 18:25:18 +0000</pubDate>
		<dc:creator>YSU</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[サーバー構築]]></category>
		<category><![CDATA[技術]]></category>
		<category><![CDATA[まとめ]]></category>

		<guid isPermaLink="false">http://morinoyume.com/?p=338</guid>
		<description><![CDATA[mysqlパーティショニングのまとめ① - 設定・再コンパイル
mysqlパーティショニングのまとめ② - パーティショニングのタイプ
 mysqlパーティショニングのまとめ③ - パフォーマンス
前回の記事では、mys [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://morinoyume.com/techs/mysql%E3%83%91%E3%83%BC%E3%83%86%E3%82%A3%E3%82%B7%E3%83%A7%E3%83%8B%E3%83%B3%E3%82%B0%E3%81%AE%E3%81%BE%E3%81%A8%E3%82%81%E2%91%A0-%E8%A8%AD%E5%AE%9A%E3%83%BB%E5%86%8D%E3%82%B3%E3%83%B3%E3%83%91/">mysqlパーティショニングのまとめ① - 設定・再コンパイル</a><br />
mysqlパーティショニングのまとめ② - パーティショニングのタイプ<br />
<a href="http://morinoyume.com/techs/mysql%E3%83%91%E3%83%BC%E3%83%86%E3%82%A3%E3%82%B7%E3%83%A7%E3%83%8B%E3%83%B3%E3%82%B0%E3%81%AE%E3%81%BE%E3%81%A8%E3%82%81%E2%91%A2-%E3%83%91%E3%83%95%E3%82%A9%E3%83%BC%E3%83%9E%E3%83%B3%E3%82%B9/"> mysqlパーティショニングのまとめ③ - パフォーマンス</a><br />
前回の記事では、mysqlのパーティショニングを使うための、mysql本体のセッティングについて述べたが、<br />
今回はパーティショニングの種類について記述していく。</p>
<blockquote><p>サンプルテーブル</p></blockquote>
<p>まず、説明を始める前に今回はサンプルとして、郵政省の郵便番号データを扱う以下のテーブルを用意した。<br />
いろいろカラムが分かれているが、code(郵便番号)にたいして、フラグやら県名を保持しているテーブルだ。</p>
<pre class="brush: plain;">
CREATE TABLE　`postal` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `code` int(7) NOT NULL,
  `ken_kana` varchar(255) DEFAULT NULL,
  `ctiy_kana` varchar(255) DEFAULT NULL,
  `town_kana` varchar(255) DEFAULT NULL,
  `ken` varchar(255) DEFAULT NULL,
  `citiy` varchar(255) DEFAULT NULL,
  `town` varchar(255) DEFAULT NULL,
  `flg1` tinyint(1) NOT NULL,
  `flg2` tinyint(1) NOT NULL,
  `flg3` tinyint(1) NOT NULL,
  `flg4` tinyint(1) NOT NULL,
  `flg5` tinyint(1) NOT NULL,
  `flg6` tinyint(1) NOT NULL,
  `entry` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `town` (`town`),
  KEY `flg1` (`flg1`),
  KEY `entry` (`entry`)
)
DEFAULT CHARSET=utf8
ENGINE=InnoDB;
</pre>
<blockquote><p>パーティショニングの種類</p></blockquote>
<p>さて、本題に入る。<br />
mysqlのパーティショニングには以下の４つのタイプが存在する。</p>
<ul>
<li>RANGEパーティショニング</li>
<li>LISTパーティショニング</li>
<li>[LINEAR] HASHパーティショニング</li>
<li>[LINEAR] KEYパーティショニング</li>
</ul>
<blockquote><p>RANGEパーティショニング</p></blockquote>
<p>LANGEパーティショニングとは、値の範囲を絞って、パーティショニングする方法である。<br />
あくまでも、パーティショニングする値がある程度決まっている場合などに使用できる。<br />
今回は郵便番号は12万レコード前後で推移すると考え、ＩＤを30000毎に区切ってみる。<br />
（サンプルでは、日付で絞る例がおおい）<br />
「ENGINE=InnoDB」の後ろに以下のように書き加える。</p>
<pre class="brush: plain;">
DEFAULT CHARSET=utf8
ENGINE=InnoDB
PARTITION BY RANGE (id) (
PARTITION p1 VALUES LESS THAN (30000),
PARTITION p2 VALUES LESS THAN (60000),
PARTITION p3 VALUES LESS THAN (90000),
PARTITION p4 VALUES LESS THAN MAXVALUE
);
</pre>
<blockquote><p>LISTパーティショニング</p></blockquote>
<p>LISTパーティショニングは、あるカラムの値の候補が決まっている場合に使われる。<br />
例えば、性別、誕生月、などであろうか・・・。<br />
今回はいい例ではないかもしれないが、flg1を1,0に分けてみる。<br />
「ENGINE=InnoDB」の後ろに以下のように書き加える。</p>
<pre class="brush: plain;">
DEFAULT CHARSET=utf8
ENGINE=InnoDB
PARTITION BY LIST (flg1) (
PARTITION p1 VALUES IN (0),
PARTITION p2 VALUES IN (1)
);
</pre>
<p>しかし、これはエラーになる。</p>
<pre class="brush: plain;">
 A PRIMARY KEY must include all columns in the table's partitioning function
</pre>
<p>プライマリーはパーティショニングの定義に入れなければならない・・・とのこと。なんやねん。<br />
といわけで、<a href="http://d.hatena.ne.jp/cloned/20090506">MySQLのパーティショニングで必要そうな工夫</a>を元に以下みたいな書き方をしてみる。</p>
<pre class="brush: plain;">
DEFAULT CHARSET=utf8
ENGINE=InnoDB
PARTITION BY LIST (( id * 0 ) + flg1) (
PARTITION p1 VALUES IN (0),
PARTITION p2 VALUES IN (1)
);
</pre>
<p>うーん・・・いけない・・・。<br />
ちなみに、<a href="http://dev.mysql.com/doc/refman/5.1/ja/partitioning-limitations.html">15.5. パーティショニングの制約と制限</a>によれば、</p>
<div style="color:blue;">「パーティショニング表現内の他のカラムを使用してこのテーブルをパーティショニングしたい場合、まず必要なカラムをプライマリキーに追加するか、プライマリキー自体を破棄することでテーブルを改良しなければいけません。<span style="color:red;">将来的に、この制限をMySQLから取り除く方向で開発を進めています。</span>」</div>
<p>とのこと。是非、取り除いてほしいですね。<br />
どうやらlistを使用するにはprimaryを外さないと使えなさそうだが、いけてなさすぎるので今回はつかわない。</p>
<blockquote><p>[LINEAR] HASHパーティショニング</p></blockquote>
<p>HASHパーティショニングとは、行が格納されるパーティションを算出するのにMOD（剰余）を利用するものである。<br />
RANGEやLISTと違い、あらかじめ値の範囲や候補をしらなくても動的にパーティショニングできる。<br />
また、各パーティショニングのかたよりも無いと思われる。</p>
<p>また、LINER HASHというものがあるが、これは<a href="http://dev.mysql.com/doc/refman/5.1/ja/partitioning-linear-hash.html"><br />
15.2.3.1. LINEAR HASH パーティショニング</a>によれば</p>
<div style="color:blue;">「リニアハッシュによるパーティショニングの利点は、パーティションの追加、削除、結合、そして分裂のスピードアップが図れることです。これは、大量のデータ（テラバイト級）を含むテーブルを取り扱う際に、効果的です。欠点は、通常のハッシュパーティショニングを使用した時に比べデータがパーティションの間で不均等に割り振られていることがあります。」</div>
<p>とのことらしい、だが計算が難しくてよくわからないが<a href="http://nippondanji.blogspot.com/2009/05/linear-hash.html">漢(オトコ)のコンピュータ道</a>によれば、</p>
<div style="color:blue;">「テーブルが大きい場合にはHASH/KEYではなくLINEAR HASH/LINEAR KEYパーティショニングを利用すること。ただしパーティション数は2の累乗で！」</div>
<p>ということらしい。<br />
なので、HASHを使う場合は「ENGINE=InnoDB」の後ろに以下のように書き加えるとよいだろう。<br />
下記の例だと、idをキーにして1024パーティショニングすることになる。<br />
１パーティショニングあたり、120くらい、めっちゃはやそう。<br />
＊1024がパーティショニングの限界値</p>
<pre class="brush: plain;">
DEFAULT CHARSET=utf8
ENGINE=InnoDB
PARTITION BY LINEAR HASH (id) PARTITIONS 1024;
</pre>
<blockquote><p>[LINEAR] KEYパーティショニング</p></blockquote>
<p>KEYパーティショニングはPASSWORD()関数を使ってハッシュ値を算出する。PASSWORD関数を利用するので、文字列に対しても利用することが出来る。が、ここでもPrimaryの制約があり使用できそうにない（ためしていない）。<br />
もし、教科書的に書くなら「ENGINE=InnoDB」の後ろに以下のように書き加える感じだと思う。</p>
<pre class="brush: plain;">
DEFAULT CHARSET=utf8
ENGINE=InnoDB
PARTITION BY LINEAR KEY(ken) PARTITIONS 1024
);
</pre>
<blockquote><p>パーティショニング確認</p></blockquote>
<p>以上がパーティショニングの説明となる。<br />
これらのテーブルのパーティショニングの状態をチェックするには、</p>
<pre class="brush: plain;">
SELECT * FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME=postal
</pre>
<p>というＳＱＬを投げれば確認できる。<br />
では、次回はパーティショニングのパフォーマンスについて述べていこうと思う。</p>
<h3  class="related_post_title">関連の記事</h3><ul class="related_post"><li>2009 年 12 月 8 日 -- <a href="http://morinoyume.com/techs/mysql%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%8b%e3%83%b3%e3%82%b0%e3%81%ae%e3%81%be%e3%81%a8%e3%82%81%e2%91%a2-%e3%83%91%e3%83%95%e3%82%a9%e3%83%bc%e3%83%9e%e3%83%b3%e3%82%b9/" title="mysqlパーティショニングのまとめ③- パフォーマンス">mysqlパーティショニングのまとめ③- パフォーマンス</a></li><li>2009 年 12 月 8 日 -- <a href="http://morinoyume.com/techs/mysql%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%8b%e3%83%b3%e3%82%b0%e3%81%ae%e3%81%be%e3%81%a8%e3%82%81%e2%91%a0-%e8%a8%ad%e5%ae%9a%e3%83%bb%e5%86%8d%e3%82%b3%e3%83%b3%e3%83%91/" title="mysqlパーティショニングのまとめ① &#8211; 設定・再コンパイル">mysqlパーティショニングのまとめ① &#8211; 設定・再コンパイル</a></li><li>2010 年 1 月 17 日 -- <a href="http://morinoyume.com/others/2010%e5%b9%b4%e3%81%ae%e7%9b%ae%e6%a8%99%ef%bc%81%ef%bc%81/" title="2010年の目標！！">2010年の目標！！</a></li><li>2009 年 11 月 29 日 -- <a href="http://morinoyume.com/techs/phpmyadmin%e3%81%a7%e3%82%a8%e3%83%a9%e3%83%bc%e3%81%af%e3%81%aa%e3%81%84%e3%81%8c%e3%83%ad%e3%82%b0%e3%82%a4%e3%83%b3%e3%81%a7%e3%81%8d%e3%81%aa%e3%81%84%e7%8f%be%e8%b1%a1%e3%81%ab%e3%81%a4%e3%81%84/" title="phpMyAdminでエラーはないがログインできない現象について">phpMyAdminでエラーはないがログインできない現象について</a></li><li>2009 年 11 月 28 日 -- <a href="http://morinoyume.com/techs/symfony%e3%81%a7%e3%81%be%e3%81%9a%e3%81%af%e3%83%97%e3%83%ad%e3%82%b8%e3%82%a7%e3%82%af%e3%83%88%e4%bd%9c%e6%88%90/" title="symfonyでまずはプロジェクト作成">symfonyでまずはプロジェクト作成</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://morinoyume.com/techs/mysql%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%8b%e3%83%b3%e3%82%b0%e3%81%ae%e3%81%be%e3%81%a8%e3%82%81%e2%91%a1-%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%8b/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://morinoyume.com/techs/mysql%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%8b%e3%83%b3%e3%82%b0%e3%81%ae%e3%81%be%e3%81%a8%e3%82%81%e2%91%a1-%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%8b/" />
	</item>
		<item>
		<title>mysqlパーティショニングのまとめ① &#8211; 設定・再コンパイル</title>
		<link>http://morinoyume.com/techs/mysql%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%8b%e3%83%b3%e3%82%b0%e3%81%ae%e3%81%be%e3%81%a8%e3%82%81%e2%91%a0-%e8%a8%ad%e5%ae%9a%e3%83%bb%e5%86%8d%e3%82%b3%e3%83%b3%e3%83%91/</link>
		<comments>http://morinoyume.com/techs/mysql%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%8b%e3%83%b3%e3%82%b0%e3%81%ae%e3%81%be%e3%81%a8%e3%82%81%e2%91%a0-%e8%a8%ad%e5%ae%9a%e3%83%bb%e5%86%8d%e3%82%b3%e3%83%b3%e3%83%91/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 18:22:17 +0000</pubDate>
		<dc:creator>YSU</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[サーバー構築]]></category>
		<category><![CDATA[技術]]></category>
		<category><![CDATA[まとめ]]></category>
		<category><![CDATA[インフラ]]></category>
		<category><![CDATA[自宅サーバー]]></category>

		<guid isPermaLink="false">http://morinoyume.com/?p=326</guid>
		<description><![CDATA[mysqlパーティショニングのまとめ① - 設定・再コンパイル
 mysqlパーティショニングのまとめ② - パーティショニングのタイプ
 mysqlパーティショニングのまとめ③ - パフォーマンス
mysqlのパーティ [...]]]></description>
			<content:encoded><![CDATA[<p>mysqlパーティショニングのまとめ① - 設定・再コンパイル<br />
<a href="http://morinoyume.com/techs/mysql%E3%83%91%E3%83%BC%E3%83%86%E3%82%A3%E3%82%B7%E3%83%A7%E3%83%8B%E3%83%B3%E3%82%B0%E3%81%AE%E3%81%BE%E3%81%A8%E3%82%81%E2%91%A1-%E3%83%91%E3%83%BC%E3%83%86%E3%82%A3%E3%82%B7%E3%83%A7%E3%83%8B/"> mysqlパーティショニングのまとめ② - パーティショニングのタイプ</a><br />
<a href="http://morinoyume.com/techs/mysql%E3%83%91%E3%83%BC%E3%83%86%E3%82%A3%E3%82%B7%E3%83%A7%E3%83%8B%E3%83%B3%E3%82%B0%E3%81%AE%E3%81%BE%E3%81%A8%E3%82%81%E2%91%A2-%E3%83%91%E3%83%95%E3%82%A9%E3%83%BC%E3%83%9E%E3%83%B3%E3%82%B9/"> mysqlパーティショニングのまとめ③ - パフォーマンス</a></p>
<p>mysqlのパーティショニングを試してみたかったが、<br />
私のmysqlではパーティショニングが使えなかったようなので<br />
今日はmysqlパーティショニングの再コンパイルについて</p>
<p>まずは、mysqlのパーティショニングが使えるかどうか調べる。</p>
<pre class="brush: plain;">
mysql&gt; SHOW VARIABLES LIKE '%PARTITION%' ;
+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| have_partitioning | YES   |
+-------------------+-------+
1 row in set (0.01 sec)
</pre>
<p>上記のようにhave_partitioningがYESとなっていたら、パーティショニングが使用可能である。<br />
私は使用不可であったので、再コンパイルしなければならない。</p>
<p>まずは念のためmysqlをストップ</p>
<pre class="brush: plain;">
/usr/local/mysql/share/mysql/mysql.server stop
</pre>
<p>*パスは各自のパスをご確認ください。</p>
<p>以前のコンパイルオプションに</p>
<pre class="brush: plain;">
--with-ndbcluster--with-partition
</pre>
<p>をつけて</p>
<pre class="brush: plain;">
make
make install
</pre>
<p>で再コンパイル完了。<br />
ちなみに、以前のコンパイルオプションは<br />
mysqlのソースがはいっているディレクトリに移動して</p>
<pre class="brush: plain;">
grep &quot;$ ./configure&quot; config.log
</pre>
<p>とでも打てばいいだろう。</p>
<p>あとはmysqlを起動して、パーティショニングが使用できることを確認できればＯＫだ。</p>
<pre class="brush: plain;">
/usr/local/mysql/share/mysql/mysql.server start
</pre>
<p>[おまけ]現在の私のオプション</p>
<pre class="brush: plain;">
--with-charset=utf8
--with-extra-charsets=all
--with-mysqld-user=mysql
--with-innodb
--with-falcon
--with-maria
--with-heap
--with-myisam
--enable-local-infile
--prefix=/usr/local/mysql
--with-unix-socket-path=/tmp/mysql.sock
--with-ndbcluster
--with-partition
--with-blackhole-storage-engine
</pre>
<p>いろんなストレージを試してみたい。</p>
<h3  class="related_post_title">関連の記事</h3><ul class="related_post"><li>2009 年 5 月 30 日 -- <a href="http://morinoyume.com/techs/mysql%e3%81%8c%e7%ab%8b%e3%81%a1%e4%b8%8a%e3%81%8c%e3%82%89%e3%81%aa%e3%81%84%ef%bc%81%ef%bc%88starting-mysqlmanager-of-pid-file-quit-without-updating-fi/" title="mysqlが立ち上がらない！（Starting MySQL.Manager of pid-file quit without updating file)">mysqlが立ち上がらない！（Starting MySQL.Manager of pid-file quit without updating file)</a></li><li>2009 年 4 月 20 日 -- <a href="http://morinoyume.com/techs/mysql60%e3%81%ae%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%83%a1%e3%83%a2/" title="mysql6.0のインストールメモ">mysql6.0のインストールメモ</a></li><li>2009 年 4 月 19 日 -- <a href="http://morinoyume.com/techs/configure-error-no-cursestermcap-library-found/" title="configure: error: No curses/termcap library found">configure: error: No curses/termcap library found</a></li><li>2009 年 12 月 8 日 -- <a href="http://morinoyume.com/techs/mysql%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%8b%e3%83%b3%e3%82%b0%e3%81%ae%e3%81%be%e3%81%a8%e3%82%81%e2%91%a2-%e3%83%91%e3%83%95%e3%82%a9%e3%83%bc%e3%83%9e%e3%83%b3%e3%82%b9/" title="mysqlパーティショニングのまとめ③- パフォーマンス">mysqlパーティショニングのまとめ③- パフォーマンス</a></li><li>2009 年 12 月 8 日 -- <a href="http://morinoyume.com/techs/mysql%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%8b%e3%83%b3%e3%82%b0%e3%81%ae%e3%81%be%e3%81%a8%e3%82%81%e2%91%a1-%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%8b/" title="mysqlパーティショニングのまとめ② &#8211; パーティショニングのタイプ">mysqlパーティショニングのまとめ② &#8211; パーティショニングのタイプ</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://morinoyume.com/techs/mysql%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%8b%e3%83%b3%e3%82%b0%e3%81%ae%e3%81%be%e3%81%a8%e3%82%81%e2%91%a0-%e8%a8%ad%e5%ae%9a%e3%83%bb%e5%86%8d%e3%82%b3%e3%83%b3%e3%83%91/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://morinoyume.com/techs/mysql%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%8b%e3%83%b3%e3%82%b0%e3%81%ae%e3%81%be%e3%81%a8%e3%82%81%e2%91%a0-%e8%a8%ad%e5%ae%9a%e3%83%bb%e5%86%8d%e3%82%b3%e3%83%b3%e3%83%91/" />
	</item>
		<item>
		<title>mysqlが立ち上がらない！（Starting MySQL.Manager of pid-file quit without updating file)</title>
		<link>http://morinoyume.com/techs/mysql%e3%81%8c%e7%ab%8b%e3%81%a1%e4%b8%8a%e3%81%8c%e3%82%89%e3%81%aa%e3%81%84%ef%bc%81%ef%bc%88starting-mysqlmanager-of-pid-file-quit-without-updating-fi/</link>
		<comments>http://morinoyume.com/techs/mysql%e3%81%8c%e7%ab%8b%e3%81%a1%e4%b8%8a%e3%81%8c%e3%82%89%e3%81%aa%e3%81%84%ef%bc%81%ef%bc%88starting-mysqlmanager-of-pid-file-quit-without-updating-fi/#comments</comments>
		<pubDate>Fri, 29 May 2009 17:34:48 +0000</pubDate>
		<dc:creator>YSU</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[サーバー構築]]></category>
		<category><![CDATA[技術]]></category>
		<category><![CDATA[インフラ]]></category>
		<category><![CDATA[自宅サーバー]]></category>

		<guid isPermaLink="false">http://morinoyume.com/?p=249</guid>
		<description><![CDATA[久々の投稿。
最近、暖かくなってきて休日は外にいることが多かったので、
なかなかサーバーをいじる時間がなかった・・・。
さて、突然mysqlが起動しなくなった。

Starting MySQL.Manager of pi [...]]]></description>
			<content:encoded><![CDATA[<p>久々の投稿。<br />
最近、暖かくなってきて休日は外にいることが多かったので、<br />
なかなかサーバーをいじる時間がなかった・・・。</p>
<p>さて、突然mysqlが起動しなくなった。</p>
<pre class="brush: xml;">
Starting MySQL.Manager of pid-file quit without updating file
</pre>
<p>原因は<a href="http://d.hatena.ne.jp/tomoyamkung/20081225/1230165109">いろいろ</a>あるらしいが、<br />
今回はmy.cnfの記述ミス。<br />
というより、mysqlの実行ユーザーを変えたことによる影響。</p>
<p>my.cnf</p>
<pre class="brush: xml;">
user=hogehoge
</pre>
<p>そのユーザーがmyslを実行する権限がなかったのが問題。<br />
以下で解決。</p>
<pre class="brush: xml;">
choown -R hogehoge:hogegroup /usr/local/mysql
</pre>
<p>今回は記述ミスというより、<br />
記述を変更したことによる影響であったが、<br />
上記のエラーがでるようであれば、my.cnfの設定をまず疑ってみよう。</p>
<h3  class="related_post_title">関連の記事</h3><ul class="related_post"><li>2009 年 12 月 8 日 -- <a href="http://morinoyume.com/techs/mysql%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%8b%e3%83%b3%e3%82%b0%e3%81%ae%e3%81%be%e3%81%a8%e3%82%81%e2%91%a0-%e8%a8%ad%e5%ae%9a%e3%83%bb%e5%86%8d%e3%82%b3%e3%83%b3%e3%83%91/" title="mysqlパーティショニングのまとめ① &#8211; 設定・再コンパイル">mysqlパーティショニングのまとめ① &#8211; 設定・再コンパイル</a></li><li>2009 年 4 月 20 日 -- <a href="http://morinoyume.com/techs/mysql60%e3%81%ae%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%83%a1%e3%83%a2/" title="mysql6.0のインストールメモ">mysql6.0のインストールメモ</a></li><li>2009 年 4 月 19 日 -- <a href="http://morinoyume.com/techs/configure-error-no-cursestermcap-library-found/" title="configure: error: No curses/termcap library found">configure: error: No curses/termcap library found</a></li><li>2009 年 11 月 28 日 -- <a href="http://morinoyume.com/techs/tcsh%e3%81%ae%e5%b0%8e%e5%85%a5%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab/" title="tcshの導入(インストール)">tcshの導入(インストール)</a></li><li>2009 年 5 月 30 日 -- <a href="http://morinoyume.com/techs/mcrypt-%e6%8b%a1%e5%bc%b5%e3%82%92%e3%83%ad%e3%83%bc%e3%83%89%e3%81%a7%e3%81%8d%e3%81%be%e3%81%9b%e3%82%93%e3%80%82php-%e3%81%ae%e8%a8%ad%e5%ae%9a%e3%82%92%e7%a2%ba%e8%aa%8d%e3%81%97%e3%81%a6%e3%81%8f/" title="mcrypt 拡張をロードできません。PHP の設定を確認してください。">mcrypt 拡張をロードできません。PHP の設定を確認してください。</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://morinoyume.com/techs/mysql%e3%81%8c%e7%ab%8b%e3%81%a1%e4%b8%8a%e3%81%8c%e3%82%89%e3%81%aa%e3%81%84%ef%bc%81%ef%bc%88starting-mysqlmanager-of-pid-file-quit-without-updating-fi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://morinoyume.com/techs/mysql%e3%81%8c%e7%ab%8b%e3%81%a1%e4%b8%8a%e3%81%8c%e3%82%89%e3%81%aa%e3%81%84%ef%bc%81%ef%bc%88starting-mysqlmanager-of-pid-file-quit-without-updating-fi/" />
	</item>
		<item>
		<title>mysql6.0のインストールメモ</title>
		<link>http://morinoyume.com/techs/mysql60%e3%81%ae%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%83%a1%e3%83%a2/</link>
		<comments>http://morinoyume.com/techs/mysql60%e3%81%ae%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%83%a1%e3%83%a2/#comments</comments>
		<pubDate>Sun, 19 Apr 2009 15:28:17 +0000</pubDate>
		<dc:creator>YSU</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[サーバー構築]]></category>
		<category><![CDATA[技術]]></category>
		<category><![CDATA[インフラ]]></category>
		<category><![CDATA[自宅サーバー]]></category>

		<guid isPermaLink="false">http://morinoyume.com/?p=241</guid>
		<description><![CDATA[http://www.y-kit.jp/saba/xp/mysqllinuxinst.htm
]]></description>
			<content:encoded><![CDATA[<p>タイトルのとおり、myql6.0をインストールしてみた。<br />
まずは、rootになっておく。</p>
<pre class="brush: xml;">
su - root
</pre>
<p>そして、mysqlの取得。最新版は（<a href="http://dev.mysql.com/downloads/">http://dev.mysql.com/downloads/</a>）でチェック。<br />
場所は、/usr/local/src/が適当だと思われる。</p>
<pre class="brush: xml;">
cd /usr/local/src/
wget http://dev.mysql.com/get/Downloads/MySQL-6.0/mysql-6.0.10-alpha.tar.gz/from/http://ftp.jaist.ac.jp/pub/mysql/
</pre>
<p>ダウンロードできたら、解凍と対象ディレクトリに移動</p>
<pre class="brush: xml;">
tar xvzf mysql-6.0.10-alpha.tar.gz
cd mysql-6.0.10-alpha
</pre>
<p>次にconfigure。</p>
<pre class="brush: xml;">
./configure --help
</pre>
<p>とやるとconfigureオプションが見れる。よくわからない。<br />
とりあえず今回は下記のオプションで。</p>
<pre class="brush: xml;">
./configure --with-charset=utf8 --with-extra-charsets=all --with-mysqld-user=root --with-innodb --with-falcon --with-maria --with-heap --with-myisam --enable-local-infile --prefix=/usr/local/mysql --with-unix-socket-path=/tmp/mysql.sock
</pre>
<ul>
<li>--with-charset=utf8 : 文字コードはutf-8</li>
<li>--with-extra-charsets=all : 他の文字コードは全部つかう</li>
<li>--with-mysqld-user=root : mysqldを実行するユーザー。（rootにしないほうがよかったかも・・・）</li>
<li>--with-innodb : innodbを使う。</li>
<li>--with-falcon : falconを使う。</li>
<li>--with-maria : mariaを使う。</li>
<li>--with-heap : memoryを使う。</li>
<li>--with-myisam : myisam を使う。</li>
<li>--enable-local-infile  : よくわからない・・・</li>
<li> --prefix=/usr/local/mysql  : インストール先</li>
<li> --with-unix-socket-path=/tmp/mysql.sock  : ソケットファイルのパス。よくわからない・・・。</li>
</ul>
<p>こまったことにconfigure中にエラー発生。</p>
<pre class="brush: xml;">
checking for termcap functions library... configure: error: No curses/termcap library found
</pre>
<p>うーん・・・。<br />
ググッってしらべたら</p>
<pre class="brush: xml;">
yum install ncurses-devel
</pre>
<p>で、解決。これもなぜ解決なのかよくわからない。<br />
次にmake,make install</p>
<pre class="brush: xml;">
make
make install
</pre>
<p>makeは異常な時間がかかるので、お茶でも飲んでおく。<br />
完了したらデータベースの初期化をしといたほうがいいらしい。</p>
<pre class="brush: xml;">
./scripts/mysql_install_db --user=root
</pre>
<p>以上でmysqlのインストールは完了。<br />
mysql起動。</p>
<pre class="brush: xml;">
/usr/local/mysql/bin/mysqld_safe --user=root &amp;
</pre>
<p>mysqlコマンドはよく使うので、<br />
パスを通しておく。</p>
<pre class="brush: xml;">
PATH=$PATH:/usr/local/mysql/bin
export PATH
</pre>
<p>これで、mysqlも準備完了。<br />
だんだん環境が整ってきた。早く開発するのが楽しみだ。</p>
<p>参考：<br />
<a href="http://www.y-kit.jp/saba/xp/mysqllinuxinst.htm">http://www.y-kit.jp/saba/xp/mysqllinuxinst.htm<br />
</a></p>
<h3  class="related_post_title">関連の記事</h3><ul class="related_post"><li>2009 年 12 月 8 日 -- <a href="http://morinoyume.com/techs/mysql%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%8b%e3%83%b3%e3%82%b0%e3%81%ae%e3%81%be%e3%81%a8%e3%82%81%e2%91%a0-%e8%a8%ad%e5%ae%9a%e3%83%bb%e5%86%8d%e3%82%b3%e3%83%b3%e3%83%91/" title="mysqlパーティショニングのまとめ① &#8211; 設定・再コンパイル">mysqlパーティショニングのまとめ① &#8211; 設定・再コンパイル</a></li><li>2009 年 5 月 30 日 -- <a href="http://morinoyume.com/techs/mysql%e3%81%8c%e7%ab%8b%e3%81%a1%e4%b8%8a%e3%81%8c%e3%82%89%e3%81%aa%e3%81%84%ef%bc%81%ef%bc%88starting-mysqlmanager-of-pid-file-quit-without-updating-fi/" title="mysqlが立ち上がらない！（Starting MySQL.Manager of pid-file quit without updating file)">mysqlが立ち上がらない！（Starting MySQL.Manager of pid-file quit without updating file)</a></li><li>2009 年 4 月 19 日 -- <a href="http://morinoyume.com/techs/configure-error-no-cursestermcap-library-found/" title="configure: error: No curses/termcap library found">configure: error: No curses/termcap library found</a></li><li>2009 年 11 月 28 日 -- <a href="http://morinoyume.com/techs/tcsh%e3%81%ae%e5%b0%8e%e5%85%a5%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab/" title="tcshの導入(インストール)">tcshの導入(インストール)</a></li><li>2009 年 5 月 30 日 -- <a href="http://morinoyume.com/techs/mcrypt-%e6%8b%a1%e5%bc%b5%e3%82%92%e3%83%ad%e3%83%bc%e3%83%89%e3%81%a7%e3%81%8d%e3%81%be%e3%81%9b%e3%82%93%e3%80%82php-%e3%81%ae%e8%a8%ad%e5%ae%9a%e3%82%92%e7%a2%ba%e8%aa%8d%e3%81%97%e3%81%a6%e3%81%8f/" title="mcrypt 拡張をロードできません。PHP の設定を確認してください。">mcrypt 拡張をロードできません。PHP の設定を確認してください。</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://morinoyume.com/techs/mysql60%e3%81%ae%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%83%a1%e3%83%a2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://morinoyume.com/techs/mysql60%e3%81%ae%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%83%a1%e3%83%a2/" />
	</item>
		<item>
		<title>configure: error: No curses/termcap library found</title>
		<link>http://morinoyume.com/techs/configure-error-no-cursestermcap-library-found/</link>
		<comments>http://morinoyume.com/techs/configure-error-no-cursestermcap-library-found/#comments</comments>
		<pubDate>Sun, 19 Apr 2009 13:38:40 +0000</pubDate>
		<dc:creator>YSU</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[サーバー構築]]></category>
		<category><![CDATA[技術]]></category>
		<category><![CDATA[インフラ]]></category>
		<category><![CDATA[自宅サーバー]]></category>

		<guid isPermaLink="false">http://morinoyume.com/?p=232</guid>
		<description><![CDATA[mysql6.0の"configure"中に、

checking for termcap functions library... configure: error: No curses/termcap library [...]]]></description>
			<content:encoded><![CDATA[<p>mysql6.0の"configure"中に、</p>
<pre class="brush: xml;">
checking for termcap functions library... configure: error: No curses/termcap library found
</pre>
<p>と言われた。<br />
よくわからないのでググッってみたら、</p>
<pre class="brush: xml;">
yum install ncurses-devel
</pre>
<p>yumで上記をインストールをすれば問題なくconfigureできました。<br />
理由はよくわからないけど、できたからいいや。</p>
<h3  class="related_post_title">関連の記事</h3><ul class="related_post"><li>2009 年 12 月 8 日 -- <a href="http://morinoyume.com/techs/mysql%e3%83%91%e3%83%bc%e3%83%86%e3%82%a3%e3%82%b7%e3%83%a7%e3%83%8b%e3%83%b3%e3%82%b0%e3%81%ae%e3%81%be%e3%81%a8%e3%82%81%e2%91%a0-%e8%a8%ad%e5%ae%9a%e3%83%bb%e5%86%8d%e3%82%b3%e3%83%b3%e3%83%91/" title="mysqlパーティショニングのまとめ① &#8211; 設定・再コンパイル">mysqlパーティショニングのまとめ① &#8211; 設定・再コンパイル</a></li><li>2009 年 5 月 30 日 -- <a href="http://morinoyume.com/techs/mysql%e3%81%8c%e7%ab%8b%e3%81%a1%e4%b8%8a%e3%81%8c%e3%82%89%e3%81%aa%e3%81%84%ef%bc%81%ef%bc%88starting-mysqlmanager-of-pid-file-quit-without-updating-fi/" title="mysqlが立ち上がらない！（Starting MySQL.Manager of pid-file quit without updating file)">mysqlが立ち上がらない！（Starting MySQL.Manager of pid-file quit without updating file)</a></li><li>2009 年 4 月 20 日 -- <a href="http://morinoyume.com/techs/mysql60%e3%81%ae%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%83%a1%e3%83%a2/" title="mysql6.0のインストールメモ">mysql6.0のインストールメモ</a></li><li>2009 年 11 月 28 日 -- <a href="http://morinoyume.com/techs/tcsh%e3%81%ae%e5%b0%8e%e5%85%a5%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab/" title="tcshの導入(インストール)">tcshの導入(インストール)</a></li><li>2009 年 5 月 30 日 -- <a href="http://morinoyume.com/techs/mcrypt-%e6%8b%a1%e5%bc%b5%e3%82%92%e3%83%ad%e3%83%bc%e3%83%89%e3%81%a7%e3%81%8d%e3%81%be%e3%81%9b%e3%82%93%e3%80%82php-%e3%81%ae%e8%a8%ad%e5%ae%9a%e3%82%92%e7%a2%ba%e8%aa%8d%e3%81%97%e3%81%a6%e3%81%8f/" title="mcrypt 拡張をロードできません。PHP の設定を確認してください。">mcrypt 拡張をロードできません。PHP の設定を確認してください。</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://morinoyume.com/techs/configure-error-no-cursestermcap-library-found/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://morinoyume.com/techs/configure-error-no-cursestermcap-library-found/" />
	</item>
	</channel>
</rss>
