<?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>PHPプログラマのバリ・ポジ情報ブログ &#187; mysql</title>
	<atom:link href="http://blog.veryposi.info/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.veryposi.info</link>
	<description>PHP,JavaScriptやサーバーの設定などのプログラミングに関する情報をバリ・ポジティブに発信しているプログラマのブログ、『バリ・ポジ』</description>
	<lastBuildDate>Thu, 10 May 2012 06:23:01 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>mysqlのコネクション数を数える</title>
		<link>http://blog.veryposi.info/programing/sql/mysq%ef%bd%8c-connection/</link>
		<comments>http://blog.veryposi.info/programing/sql/mysq%ef%bd%8c-connection/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 13:48:02 +0000</pubDate>
		<dc:creator>gensan</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://blog.veryposi.info/?p=1300</guid>
		<description><![CDATA[MySQLのコネクション数を調べる方法 1 mysqladmin -u root -p extended-STATUS &#124; egrep '(Max&#124;Threads_)' これでいいみたい 参考サイト：www.thinki [...]]]></description>
			<content:encoded><![CDATA[<p>MySQLのコネクション数を調べる方法</p>
<div class="syntax">
<table>
<tbody>
<tr>
<td class="line_numbers">
<pre>
1
</pre>
</td>
<td class="code">
<pre class="sql">
mysqladmin -u root -p extended-<span style="color: rgb(153, 51, 51); font-weight: bold;">STATUS</span> | egrep <span style="color: rgb(255, 0, 0);">'(Max|Threads_)'</span></pre>
</td>
</tr>
</tbody>
</table>
</div>
<p>これでいいみたい</p>
<p>参考サイト：<a href="http://www.thinkit.co.jp/free/article/0707/2/2/">www.thinkit.co.jp/free/article/0707/2/2/</a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.veryposi.info/programing/sql/mysq%ef%bd%8c-connection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysqlでレプリケーションできなかった理由 bind-address</title>
		<link>http://blog.veryposi.info/server/server-setup/mysql-replicatio-bind-address/</link>
		<comments>http://blog.veryposi.info/server/server-setup/mysql-replicatio-bind-address/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 01:27:54 +0000</pubDate>
		<dc:creator>gensan</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[設定]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://blog.veryposi.info/?p=1206</guid>
		<description><![CDATA[MySQLでレプリケーションを試していてなぜか、Slaveから接続を試みると 1 Apr 20 10:04:21 ubuntu-be02 mysqld[4355]: 090420 10:04:21 [ERROR] Sla [...]]]></description>
			<content:encoded><![CDATA[<p>MySQLでレプリケーションを試していてなぜか、Slaveから接続を試みると</p>
<div class="syntax">
<table>
<tbody>
<tr>
<td class="line_numbers">
<pre>
1
</pre>
</td>
<td class="code">
<pre class="div">
Apr <span style="color: rgb(204, 102, 204);">20</span> <span style="color: rgb(204, 102, 204);">10</span>:<span style="color: rgb(204, 102, 204);">04</span>:<span style="color: rgb(204, 102, 204);">21</span> ubuntu-be02 mysqld<span style="color: rgb(68, 170, 68);">[</span><span style="color: rgb(204, 102, 204);">4355</span><span style="color: rgb(68, 170, 68);">]</span>: <span style="color: rgb(204, 102, 204);">090420</span> <span style="color: rgb(204, 102, 204);">10</span>:<span style="color: rgb(204, 102, 204);">04</span>:<span style="color: rgb(204, 102, 204);">21</span> <span style="color: rgb(68, 170, 68);">[</span>ERROR<span style="color: rgb(68, 170, 68);">]</span> Slave I/O thread: error connecting <span style="color: rgb(0, 64, 177);">TO</span> master <span style="color: rgb(255, 0, 0);">'repl@192.168.133.200:3306'</span>: Error: <span style="color: rgb(255, 0, 0);">'Lost connection to MySQL server at '</span>reading initial communication packet<span style="color: rgb(255, 0, 0);">', system error: 111'</span>  errno: <span style="color: rgb(204, 102, 204);">2013</span>  retry-time: <span style="color: rgb(204, 102, 204);">60</span>  retries: <span style="color: rgb(204, 102, 204);">86400</span></pre>
</td>
</tr>
</tbody>
</table>
</div>
<p>syslogに上記ログが出力されていた・・・うまくレプリケーション出来ない。</p>
<p>色々と調べたらMaster側のmy.cnfの設定項目で「<span style="background-color: rgb(255, 255, 153);">bind-address</span>」を設定しているのよくなかったみたい。</p>
<p>これは、TCP接続できるアドレスをかかないといけないみたい。ここがデフォルトでは</p>
<div class="syntax">
<table>
<tbody>
<tr>
<td class="line_numbers">
<pre>
1
</pre>
</td>
<td class="code">
<pre class="div">
bind-address           = <span style="color: rgb(204, 102, 204);">127.0</span><span style="color: rgb(204, 102, 204);">.0</span><span style="color: rgb(204, 102, 204);">.1</span></pre>
</td>
</tr>
</tbody>
</table>
</div>
<p>ローカルホストのみとなっているのでコメントアウトする。</p>
<p>でSlaveをスタートしてみると・・・見事接続成功<img alt="" src="http://blog.veryposi.info/wp-content/plugins/fckeditor-for-wordpress-plugin/smiles/typepad/happy01.gif" /><img alt="" src="http://blog.veryposi.info/wp-content/plugins/fckeditor-for-wordpress-plugin/smiles/typepad/scissors.gif" /></p>
<div class="syntax">
<table>
<tbody>
<tr>
<td class="line_numbers">
<pre>
1
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
</pre>
</td>
<td class="code">
<pre class="sql">
mysql&gt; <span style="color: rgb(153, 51, 51); font-weight: bold;">SHOW</span> slave <span style="color: rgb(153, 51, 51); font-weight: bold;">STATUS</span>\G
*************************** <span style="color: rgb(204, 102, 204);">1</span>. row ***************************
             Slave_IO_State: Waiting <span style="color: rgb(153, 51, 51); font-weight: bold;">FOR</span> master <span style="color: rgb(153, 51, 51); font-weight: bold;">TO</span> send event
                Master_Host: <span style="color: rgb(204, 102, 204);">192.168</span><span style="color: rgb(204, 102, 204);">.133</span><span style="color: rgb(204, 102, 204);">.200</span>
                Master_User: repl
                Master_Port: <span style="color: rgb(204, 102, 204);">3306</span>
              Connect_Retry: <span style="color: rgb(204, 102, 204);">60</span>
            Master_Log_File: mysql-bin<span style="color: rgb(204, 102, 204);">.000004</span>
        Read_Master_Log_Pos: <span style="color: rgb(204, 102, 204);">98</span>
             Relay_Log_File: mysqld-relay-bin<span style="color: rgb(204, 102, 204);">.000006</span>
              Relay_Log_Pos: <span style="color: rgb(204, 102, 204);">235</span>
      Relay_Master_Log_File: mysql-bin<span style="color: rgb(204, 102, 204);">.000004</span>
           Slave_IO_Running: Yes
          Slave_SQL_Running: Yes
            Replicate_Do_DB:
        Replicate_Ignore_DB:
         Replicate_Do_Table:
     Replicate_Ignore_Table:
    Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
                 Last_Errno: <span style="color: rgb(204, 102, 204);">0</span>
                 Last_Error:
               Skip_Counter: <span style="color: rgb(204, 102, 204);">0</span>
        Exec_Master_Log_Pos: <span style="color: rgb(204, 102, 204);">98</span>
            Relay_Log_Space: <span style="color: rgb(204, 102, 204);">235</span>
            Until_Condition: None
             Until_Log_File:
              Until_Log_Pos: <span style="color: rgb(204, 102, 204);">0</span>
         Master_SSL_Allowed: No
         Master_SSL_CA_File:
         Master_SSL_CA_Path:
            Master_SSL_Cert:
          Master_SSL_Cipher:
             Master_SSL_Key:
      Seconds_Behind_Master: <span style="color: rgb(204, 102, 204);">0</span>
<span style="color: rgb(204, 102, 204);">1</span> row <span style="color: rgb(153, 51, 51); font-weight: bold;">IN</span> <span style="color: rgb(153, 51, 51); font-weight: bold;">SET</span> <span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(204, 102, 204);">0.00</span> sec<span style="color: rgb(102, 204, 102);">)</span></pre>
</td>
</tr>
</tbody>
</table>
</div>
<p>無事、レプリケーションされました。</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.veryposi.info/server/server-setup/mysql-replicatio-bind-address/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQLで既存のテーブルからCREATE文を生成する方法</title>
		<link>http://blog.veryposi.info/programing/sql/show-create-table-mysql/</link>
		<comments>http://blog.veryposi.info/programing/sql/show-create-table-mysql/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 09:07:15 +0000</pubDate>
		<dc:creator>gensan</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://blog.veryposi.info/?p=971</guid>
		<description><![CDATA[MySQLでテーブル定義書を作るのが面倒で、phpMyAdminで直接、データベースを生成しているとテストサーバーから本番サーバーにデータの移行する時や、念のためにバックアップを取っておきたい時などに CREATE文が欲 [...]]]></description>
			<content:encoded><![CDATA[<p>MySQLでテーブル定義書を作るのが面倒で、phpMyAdminで直接、データベースを生成しているとテストサーバーから本番サーバーにデータの移行する時や、念のためにバックアップを取っておきたい時などに</p>
<p>CREATE文が欲しくなるときがあります。</p>
<p>そんなときMySQLでは便利なSQLがあったので紹介します。</p>
<div class="syntax">
<table>
<tbody>
<tr>
<td class="line_numbers">
<pre>
1
</pre>
</td>
<td class="code">
<pre class="mysql"><span style="color: rgb(153, 51, 51); font-weight: bold;">SHOW</span> <span style="color: rgb(153, 51, 51); font-weight: bold;">CREATE TABLE</span> テーブル名</pre>
</td>
</tr>
</tbody>
</table>
</div>
<p>これで以下のように対象テーブルのCREATE文が生成されます<img src="http://blog.veryposi.info/wp-content/plugins/fckeditor-for-wordpress-plugin/smiles/typepad/sign03.gif" alt="" /></p>
<p><a href="http://blog.veryposi.info/wp-content/uploads/2009/03/show-create-table-mysql.png" rel="lightbox[971]"><img height="208" width="300" class="aligncenter size-medium wp-image-972" title="show-create-table-mysql" alt="show-create-table-mysql" src="http://blog.veryposi.info/wp-content/uploads/2009/03/show-create-table-mysql-300x208.png" /></a></p>
<p>こりゃめちゃくちゃ便利ですね～<img src="http://blog.veryposi.info/wp-content/plugins/fckeditor-for-wordpress-plugin/smiles/typepad/up.gif" alt="" /><img src="http://blog.veryposi.info/wp-content/plugins/fckeditor-for-wordpress-plugin/smiles/typepad/up.gif" alt="" /></p>
<p>これをうまく使って便利なデータ移行ツールが作れそうです。</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.veryposi.info/programing/sql/show-create-table-mysql/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MySQLでのTIMESTAMP型</title>
		<link>http://blog.veryposi.info/programing/sql/mysql-timestamp/</link>
		<comments>http://blog.veryposi.info/programing/sql/mysql-timestamp/#comments</comments>
		<pubDate>Sun, 22 Feb 2009 08:36:56 +0000</pubDate>
		<dc:creator>gensan</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://blog.veryposi.info/?p=751</guid>
		<description><![CDATA[MySQLでのTIMESTAMP型がちょっと妙なので・・・ TIMESTAMP型のカラムを生成する時に デフォルト値にcurrent_timestampを設定できる レコードが更新された時に自動的に現在時刻でTIMEST [...]]]></description>
			<content:encoded><![CDATA[<p>MySQLでのTIMESTAMP型がちょっと妙なので・・・<img src="http://blog.veryposi.info/wp-content/plugins/fckeditor-for-wordpress-plugin/smiles/typepad/sweat01.gif" alt="" /></p>
<p>TIMESTAMP型のカラムを生成する時に</p>
<ol>
<li>デフォルト値にcurrent_timestampを設定できる</li>
<li>レコードが更新された時に自動的に現在時刻でTIMESTAMP型のカラムを更新できる</li>
</ol>
<p>こんなカラムの属性を設定できる</p>
<p>これだけを聞くととても便利なような気がするのだが、制約がある1つのテーブルで上記設定ができるは１カラムのみなのだ<img src="http://blog.veryposi.info/wp-content/plugins/fckeditor-for-wordpress-plugin/smiles/typepad/sign02.gif" alt="" /></p>
<p>例えば、テーブルを作る時に</p>
<ul>
<li>登録日時</li>
<li>更新日時</li>
<li>削除日時</li>
</ul>
<p>の３つのカラムを作成し、</p>
<ul>
<li>登録日時は、デフォルト値にcurrent_timestampを設定、</li>
<li>更新日時は、デフォルト値にcurrent_timestampを設定と更新時に自動的に現在時刻で更新というような設定にしたいと思うのだが</li>
</ul>
<p>これができない。</p>
<p>１カラムにしか上記属性を設定できないからだ・・・。</p>
<p>なんか使い辛いゾ<img src="http://blog.veryposi.info/wp-content/plugins/fckeditor-for-wordpress-plugin/smiles/typepad/annoy.gif" alt="" /></p>
<p>ということでMySQLではTIMESTAMP型を使わずにDATETIME型を使用します。<br />
そんでもって、プログラム側で時刻を登録するようにするのが一番ベストな選択のような気がします・・・<img src="http://blog.veryposi.info/wp-content/plugins/fckeditor-for-wordpress-plugin/smiles/typepad/down.gif" alt="" /></p>
<p>なんの為の便利な機能なのだか分らん<img src="http://blog.veryposi.info/wp-content/plugins/fckeditor-for-wordpress-plugin/smiles/typepad/angry.gif" alt="" /></p>
<p>更新日時だけTIMESTAMP型という選択肢もあるかと思うが全部同じ型で統一した方がわかりやすいしね<img src="http://blog.veryposi.info/wp-content/plugins/fckeditor-for-wordpress-plugin/smiles/typepad/sign03.gif" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.veryposi.info/programing/sql/mysql-timestamp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: blog.veryposi.info @ 2026-04-22 17:29:34 -->