<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>夜行人 &#187; MySQL</title>
	<atom:link href="http://www.187299.com/archives/category/mysql/feed" rel="self" type="application/rss+xml" />
	<link>http://www.187299.com</link>
	<description>寻觅生命中的那一片浅草......</description>
	<lastBuildDate>Wed, 16 Nov 2011 11:25:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>查看nginx，apache，mysql，php编译参数</title>
		<link>http://www.187299.com/archives/1838</link>
		<comments>http://www.187299.com/archives/1838#comments</comments>
		<pubDate>Wed, 26 Oct 2011 04:57:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Nginx]]></category>

		<guid isPermaLink="false">http://www.187299.com/?p=1838</guid>
		<description><![CDATA[有时候nginx，apache，mysql，php编译完了想看看编译参数可以用以下方法 nginx编译参数： #/usr/local/nginx/sbin/nginx -V nginx version: nginx/0.6.32 built by gcc 4.1.2 20071124 (Red Hat 4.1.2-42) configure arguments: --user=www --... ]]></description>
			<content:encoded><![CDATA[<p>有时候nginx，apache，mysql，php编译完了想看看编译参数可以用以下方法</p>
<p>nginx编译参数：<br />
#/usr/local/nginx/sbin/nginx -V<br />
nginx version: nginx/0.6.32</p>
<p>built by gcc 4.1.2 20071124 (Red Hat 4.1.2-42)</p>
<p>configure arguments: --user=www --group=www --prefix=/usr/local/nginx/ --with-http_stub_status_module --with-openssl=/usr/local/openssl</p>
<p>apache编译参数：<br />
# cat /usr/local/apache2/build/config.nice<br />
#! /bin/sh</p>
<p>#</p>
<p># Created by configure</p>
<p>"./configure" \</p>
<p>"--prefix=/usr/local/apache2" \</p>
<p>"--with-included-apr" \</p>
<p>"--enable-so" \</p>
<p>"--enable-deflate=shared" \</p>
<p>"--enable-expires=shared" \</p>
<p>"--enable-rewrite=shared" \</p>
<p>"--enable-static-support" \</p>
<p>"--disable-userdir" \</p>
<p>"$@"</p>
<p>php编译参数：</p>
<p># /usr/local/php/bin/php -i |grep configure</p>
<p>Configure Command =&gt;   './configure'   '--prefix=/usr/local/php' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-config-file-path=/usr/local/php/etc' '--with-mysql=/usr/local/mysql' '--with-libxml-dir=/usr/local/libxml2/bin' '--with-gd=/usr/local/gd2' '--with-jpeg-dir' '--with-png-dir' '--with-bz2' '--with-xmlrpc' '--with-freetype-dir' '--with-zlib-dir'</p>
<p>mysql编译参数：</p>
<p># cat "/usr/local/mysql/bin/mysqlbug"|grep configure</p>
<p># This is set by configure</p>
<p>CONFIGURE_LINE="./configure '--prefix=/usr/local/mysql' '--localstatedir=/var/lib/mysql' '--with-comment=Source' '--with-server-suffix=-H863' '--with-mysqld-user=mysql' '--without-debug' '--with-big-tables' '--with-charset=gbk' '--with-collation=gbk_chinese_ci' '--with-extra-charsets=all' '--with-pthread' '--enable-static' '--enable-thread-safe-client' '--with-client-ldflags=-all-static' '--with-mysqld-ldflags=-all-static' '--enable-assembler' '--without-isam' '--without-innodb' '--without-ndb-debug'"</p>
<p>转载自：http://hi.baidu.com/xi4oyu/blog/item/8a0e1ed020e81adb562c8452.html</p>
]]></content:encoded>
			<wfw:commentRss>http://www.187299.com/archives/1838/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>利用rpmbuild制作MySQL的rpm包</title>
		<link>http://www.187299.com/archives/1822</link>
		<comments>http://www.187299.com/archives/1822#comments</comments>
		<pubDate>Wed, 19 Oct 2011 01:16:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[rpmbuild]]></category>

		<guid isPermaLink="false">http://www.187299.com/?p=1822</guid>
		<description><![CDATA[1、配置环境 yum -y install rpmbuild 2、下载源代码rpm包 mkdir /root/download cd /root/download wget http://www.percona.com/redir/downloads/Percona-Server-5.1/Percona-Server-5.1.58-12.9/source/Percona-Server-51-5.1.58-rel12.9.271.rhel6.src.rpm ... ]]></description>
			<content:encoded><![CDATA[<p>1、配置环境<br />
yum -y install rpmbuild<br />
2、下载源代码rpm包<br />
mkdir /root/download<br />
cd /root/download<br />
wget <a href="http://www.percona.com/redir/downloads/Percona-Server-5.1/Percona-Server-5.1.58-12.9/source/Percona-Server-51-5.1.58-rel12.9.271.rhel6.src.rpm">http://www.percona.com/redir/downloads/Percona-Server-5.1/Percona-Server-5.1.58-12.9/source/Percona-Server-51-5.1.58-rel12.9.271.rhel6.src.rpm</a></p>
<p>3、安装打包MySQL时依赖的包</p>
<p>yum -y install perl readline-devel gcc-c++ ncurses-devel zlib-devel libtool automake autoconf time ccache bison</p>
<p>4、安装percona的源代码<br />
rpm -ivh Percona-Server-51-5.1.58-rel12.9.271.rhel6.src.rpm</p>
<p>安装了2个文件，它们的位置是<br />
/root/rpmbuild/SOURCES/Percona-Server-5.1.58.tar.gz<br />
/root/rpmbuild/SPECS/percona-server.spec</p>
<p>5、修改percona-server.spec<br />
加入我们自己的编译参数<br />
vi percona-server.spec<br />
将<br />
# The --enable-assembler simply does nothing on systems that does not<br />
# support assembler speedups.<br />
和<br />
%if %{YASSL_BUILD}<br />
之间的一段修改成这样</p>
<p># The --enable-assembler simply does nothing on systems that does not<br />
# support assembler speedups.<br />
sh -c  "CFLAGS=\"$CFLAGS\" \<br />
        CXXFLAGS=\"$CXXFLAGS\" \<br />
        AM_CPPFLAGS=\"$AM_CPPFLAGS\" \<br />
        LDFLAGS=\"$LDFLAGS\" \<br />
        ./configure \<br />
            $* \<br />
            --with-comment=MC-DB \<br />
            --with-server-suffix=-MC-DB-Server \<br />
            --with-charset=utf8 \<br />
            --with-plugins=blackhole,csv,innodb_plugin \<br />
            --enable-assembler \<br />
            --enable-local-infile \<br />
            --with-mysqld-user=%{mysqld_user} \<br />
            --with-unix-socket-path=/tmp/mysql.sock \<br />
            --with-pic \<br />
            -prefix=/usr \<br />
            --with-extra-charsets=gbk,gb2312,utf8 \<br />
            --without-debug \<br />
            --with-pthread \<br />
            --enable-thread-safe-client \<br />
            --with-client-ldflags=-all-static \<br />
            --without-ndb-debug \<br />
%if %{YASSL_BUILD}</p>
<p>保存退出</p>
<p>6、定义在打包过程中不进行测试<br />
export MYSQL_RPMBUILD_TEST="no"</p>
<p>7、开始打包<br />
cd /root/rpmbuild/SPECS/<br />
rpmbuild -bb percona-server.spec<br />
等待一段时间就可以看到编译好的软件包<br />
/root/rpmbuild/RPMS/x86_64</p>
<p>Percona-Server-client-51-5.1.58-rel12.9.rhel6.x86_64.rpm<br />
Percona-Server-devel-51-5.1.58-rel12.9.rhel6.x86_64.rpm<br />
Percona-Server-server-51-5.1.58-rel12.9.rhel6.x86_64.rpm<br />
Percona-Server-shared-51-5.1.58-rel12.9.rhel6.x86_64.rpm<br />
Percona-Server-test-51-5.1.58-rel12.9.rhel6.x86_64.rpm</p>
<p>7、安装顺序<br />
先安装这个<br />
Percona-Server-shared-51-5.1.58-rel12.9.rhel6.x86_64.rpm<br />
再安装其他软件包<br />
8、已知问题：<br />
无法打包为一个包<br />
无法将所有问题安装到一个目录，例如我们之前一直安装的目录/usr/local/mysql</p>
<p>9、题外话<br />
一般MySQL源代码包都有包含打包所需要的spec文件，一般存放在support-files/下</p>
]]></content:encoded>
			<wfw:commentRss>http://www.187299.com/archives/1822/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>自动kill掉超时的mysql show processlist进程</title>
		<link>http://www.187299.com/archives/1674</link>
		<comments>http://www.187299.com/archives/1674#comments</comments>
		<pubDate>Thu, 23 Sep 2010 13:57:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.187299.com/?p=1674</guid>
		<description><![CDATA[DB_HOST="localhost" DB_PORT=3306 DB_USER="root" DB_PASS="" maxtime=10 sql="SHOW PROCESSLIST" sss=$(/usr/bin/mysqladmin processlist&#124;sed -e "s/\s//g"&#124;awk -F'&#124;' '{print $2,$7,substr($9,1,6)}'&#124;awk '{if($2&#62;'"$maxtime"' &#38;&#38; $3=="... ]]></description>
			<content:encoded><![CDATA[<p>DB_HOST="localhost"<br />
DB_PORT=3306<br />
DB_USER="root"<br />
DB_PASS=""<br />
maxtime=10<br />
sql="SHOW PROCESSLIST"<br />
sss=$(/usr/bin/mysqladmin processlist|sed -e "s/\s//g"|awk -F'|' '{print $2,$7,substr($9,1,6)}'|awk '{if($2&gt;'"$maxtime"' &amp;&amp; $3=="SELECT"){print $1}}')<br />
for pid in $(echo "$sss"); do<br />
/usr/bin/mysql -h$DB_HOST -P$DB_PORT -u$DB_USER -p$DB_PASS -e "kill $pid"<br />
done<br />
echo "$sss"<br />
date</p>
<p>转载自：http://home.phpchina.com/space.php?uid=24549&amp;do=blog&amp;id=158758</p>
]]></content:encoded>
			<wfw:commentRss>http://www.187299.com/archives/1674/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL报错：my_global.h151615 error new No such file or directory</title>
		<link>http://www.187299.com/archives/1665</link>
		<comments>http://www.187299.com/archives/1665#comments</comments>
		<pubDate>Mon, 13 Sep 2010 09:42:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.187299.com/?p=1665</guid>
		<description><![CDATA[今天安装MySQL,在make的时候报错，错误信息如下： In file included from mysys_priv.h:16, from my_new.cc:21: ../include/my_global.h:1516:15: error: new: No such file or directory make[1]: *** [my_new.o] Error 1 make[1]: Leaving directory `/... ]]></description>
			<content:encoded><![CDATA[<p>今天安装MySQL,在make的时候报错，错误信息如下：</p>
<p>In file included from mysys_priv.h:16,<br />
from my_new.cc:21:<br />
../include/my_global.h:1516:15: error: new: No such file or directory<br />
make[1]: *** [my_new.o] Error 1<br />
make[1]: Leaving directory `/opt/mysql-5.1.45-10/mysys'<br />
make: *** [all-recursive] Error 1</p>
<p>检查了操作系统版本等情况，都没问题，configure时也没报错，可以正常产生Makefile</p>
<p>将有问题服(假设是A机)的config.log和另外一台正常服(假设是B机)的config.log做对比</p>
<p>发现A机，有2处比较严重的报错</p>
<p>conftest.c:181:21: error: termcap.h: No such file or directory<br />
conftest.cpp:314:20: error: cxxabi.h: No such file or directory</p>
<p>在B机上<br />
updatedb</p>
<p>for i in `locate termcap.h`; do rpm -qf $i; done |uniq<br />
输出：<br />
libtermcap-devel-2.0.8-46.1<br />
ncurses-devel-5.5-24.20060715<br />
dev86-0.16.17-2.2</p>
<p>for i in `locate cxxabi.h`; do rpm -qf $i; done |uniq<br />
输出：</p>
<p>libstdc++-devel-4.1.2-48.el5<br />
libstdc++44-devel-4.4.0-6.el5<br />
xulrunner-devel-1.9.0.18-1.el5_4</p>
<p>到A机上用rpm -qa查询libtermcap-devel，ncurses-devel，dev86，libstdc++-devel，libstdc++44，xulrunner-devel的安装情况<br />
发现libtermcap-devel，dev86，libstdc++-devel没有安装</p>
<p>yum -y install libtermcap-devel dev86 libstdc++-devel</p>
<p>然后再make，就没有报错了</p>
]]></content:encoded>
			<wfw:commentRss>http://www.187299.com/archives/1665/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL调优脚本tuning-primer.sh使用说明</title>
		<link>http://www.187299.com/archives/1653</link>
		<comments>http://www.187299.com/archives/1653#comments</comments>
		<pubDate>Tue, 07 Sep 2010 08:32:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.187299.com/?p=1653</guid>
		<description><![CDATA[大名鼎鼎的MySQL调优脚本tuning-primer.sh官方下载地址：http://forge.mysql.com/projects/project.php?id=44 -&#62; https://launchpad.net/mysql-tuning-primer, 直接下载地址： http://launchpad.net/mysql-tuning-primer/trunk/1.5-r5/+download... ]]></description>
			<content:encoded><![CDATA[<p>大名鼎鼎的MySQL调优脚本tuning-primer.sh官方下载地址：http://forge.mysql.com/projects/project.php?id=44  -&gt; <a href="https://launchpad.net/mysql-tuning-primer" target="_blank"><span style="color: #0066cc;">https://launchpad.net/mysql-tuning-primer</span></a>, 直接下载地址： <a href="http://launchpad.net/mysql-tuning-primer/trunk/1.5-r5/+download/tuning-primer.sh" target="_blank"><span style="color: #0066cc;">http://launchpad.net/mysql-tuning-primer/trunk/1.5-r5/+download/tuning-primer.sh</span></a></p>
<p>该脚本使用 “SHOW STATUS LIKE…” 和 “SHOW VARIABLES LIKE…”  命令获得MySQL相关变量和运行状态。然后根据推荐的调优参数对当前的MySQL数据库进行测试。最后根据不同颜色的标识来提醒用户需要注意的各个参数设置。该版本兼容  MySQL 3.23 和更高版本（包含 5.1）</p>
<p>当前版本会处理如下这些推荐的参数：</p>
<div><a onclick="copycode('p755code1');" href="javascript:;"><span style="color: #0066cc;">[Copy  to clipboard]</span></a><a onclick="javascript:showCodeTxt('p755code1'); return false;" href="javascript:;"><span style="color: #0066cc;">View Code</span></a></div>
<div>
<table>
<tbody>
<tr id="p7551">
<td>
<pre>1
2
3
4
5
6
7
8
9
10
11
12</pre>
</td>
<td id="p755code1">
<pre> Slow Query Log （慢查询日志）
 Max Connections （最大连接数）
 Worker Threads （工作线程）
 <a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Akey+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky">Key</a> Buffer （<a href="http://www.google.com/search?hl=en&amp;q=allinurl%3Akey+java.sun.com&amp;btnI=I%27m%20Feeling%20Lucky">Key</a> 缓冲）
 Query Cache （查询缓存）
 Sort Buffer （排序缓存）
 Joins （连接）
 Temp Tables （临时表）
 Table (Open &amp;amp; Definition) Cache （表缓存）
 Table Locking （表锁定）
 Table Scans (read_buffer) （表扫描，读缓冲）
 Innodb Status （Innodb 状态）</pre>
</td>
</tr>
</tbody>
</table>
</div>
<p>tuning-primer.sh 有如下运行参数:</p>
<div><a onclick="copycode('p755code2');" href="javascript:;"><span style="color: #0066cc;">[Copy  to clipboard]</span></a><a onclick="javascript:showCodeTxt('p755code2'); return false;" href="javascript:;"><span style="color: #0066cc;">View Code</span></a></div>
<div>
<table>
<tbody>
<tr id="p7552">
<td>
<pre>1
2
3
4
5
6
7</pre>
</td>
<td id="p755code2">
<pre>Usage: ./tuning-primer.sh [ mode ]
all            运行所有检测(默认值)
prompt         显示提示信息
mem, memory    运行有关内存使用方面的检测
disk, file     运行有关I/O性能和文件处理限制方面的检测
innodb         运行InnoDB检测
misc           其它</pre>
</td>
</tr>
</tbody>
</table>
</div>
<p>脚本支持my.cnf文件，可以把user, password, host,  socket等连接参数放在~/.my.cnf文件里，如果使用了自定义的socket文件，请修改tuning-primer.sh文件中关于socket文件位置的变量。</p>
<p><strong>运行 tuning-primer.sh显示说明 </strong></p>
<div>
<table border="1">
<colgroup> </colgroup>
<tbody>
<tr>
<td valign="center"><strong>SLOW QUERIES</strong></td>
<td valign="center"><strong>慢查询检查</strong></td>
</tr>
<tr>
<td valign="center">SLOW QUERIESThe slow query log is enabled.</td>
<td valign="center">说明我已经启用了慢查询记录功能。也就是参数<br />
slow_query_log = 1</td>
</tr>
<tr>
<td valign="center">Current long_query_time = 5.000000 sec.</td>
<td valign="center">慢查询的阀值时间。也就是参数<br />
long_query_time = 5</td>
</tr>
<tr>
<td valign="center">You have 17 out of 638844 that take longer than 5.000000 sec.  to complete</td>
<td valign="center">说明慢查询日志中记录了17条查询时间超过5秒的语句。<br />
slow_query_log_file=/data/ats_db/mysql-slow.log设置慢查询日志路径。使用mysqldumpslow命令查询慢日志</td>
</tr>
<tr>
<td valign="center"><strong>Your long_query_time seems to be fine</strong></td>
<td valign="center">慢查询阀值时间设置得在推荐的范围内</td>
</tr>
<tr>
<td colspan="2" valign="center"></td>
</tr>
<tr>
<td valign="center"><strong>BINARY UPDATE LOG</strong></td>
<td valign="center"><strong>更新二进制日志文件</strong></td>
</tr>
<tr>
<td valign="center">The binary update log is enabled</td>
<td valign="center">这项说明启用了bin-log日志功能。参数<br />
log-bin =  /data/ats_db/mysql-bin</td>
</tr>
<tr>
<td valign="center"><strong>Binlog sync is not enabled, you could loose binlog  records during a server crash</strong></td>
<td valign="center">没有启用 sync_binlog 选项。也即是将二进制日志实时写入到磁盘通过  sync_binlog=1来指定</td>
</tr>
<tr>
<td colspan="2" valign="center"></td>
</tr>
<tr>
<td valign="center"><strong>WORKER THREADS</strong></td>
<td valign="center"><strong>工作线程</strong></td>
</tr>
<tr>
<td valign="center">Current thread_cache_size = 8</td>
<td valign="center">当前线程缓存大小。<br />
thread_concurrency = 8</td>
</tr>
<tr>
<td valign="center">Current threads_cached = 7</td>
<td valign="center">Show status like ‘threads_cached’</td>
</tr>
<tr>
<td valign="center">Current threads_per_sec = 0</td>
<td valign="center">脚本先执行Show status like ‘Threads_cached’查看当前的线程创建情况，然后sleep  1后在执行相同的命令，最终后者减去前者的数就是每秒线程创建数。</td>
</tr>
<tr>
<td valign="center">Historic threads_per_sec = 0</td>
<td valign="center">该值是使用Threads_cached /uptime获得的。</td>
</tr>
<tr>
<td valign="center"><strong>Your thread_cache_size is fine</strong></td>
<td valign="center"></td>
</tr>
<tr>
<td colspan="2" valign="center"></td>
</tr>
<tr>
<td valign="center"><strong>MAX CONNECTIONS</strong></td>
<td valign="center"><strong>最大连接数</strong></td>
</tr>
<tr>
<td valign="center">Current max_connections = 1024</td>
<td valign="center">当前配置文件中设置的并发连接数</td>
</tr>
<tr>
<td valign="center">Current threads_connected = 2</td>
<td valign="center">当前线程连接诶数。<br />
show status like ‘Threads_connected’</td>
</tr>
<tr>
<td valign="center">Historic max_used_connections = 4</td>
<td valign="center">show status like ‘Max_used_connections’;</td>
</tr>
<tr>
<td valign="center">The number of used connections is 0% of the configured  maximum.</td>
<td valign="center">这个值使用 Max_used_connections*100/ max_connections得出。</td>
</tr>
<tr>
<td valign="center"><strong>You are using less than 10% of your configured  max_connections. </strong><strong>Lowering max_connections could help to avoid  an over-allocation of memory </strong><strong>See “MEMORY USAGE” section to make sure you are not  over-allocating</strong></td>
<td valign="center">Max_used_connections的值不足max_connections值的10%。设置合适的max_connections值有助于节省内存。</td>
</tr>
<tr>
<td colspan="2" valign="center"></td>
</tr>
<tr>
<td valign="center"><strong>MEMORY USAGE</strong></td>
<td valign="center"><strong>内存使用</strong></td>
</tr>
<tr>
<td valign="center">Max Memory Ever Allocated : 841 M</td>
<td valign="center"><strong>Max Memory Ever Allocated</strong> =  <strong>max_memory</strong></td>
</tr>
<tr>
<td valign="center">Configured Max Per-thread Buffers : 28.40 G</td>
<td valign="center"><strong>Configured Max Per-thread Buffers </strong>=  <strong>per_thread_buffers</strong></td>
</tr>
<tr>
<td valign="center">Configured Max Global Buffers : 586 M</td>
<td valign="center"><strong>Configured Max Global Buffers</strong> =  <strong>per_thread_max_buffers</strong></td>
</tr>
<tr>
<td valign="center">Configured Max Memory Limit : 28.97 G</td>
<td valign="center"><strong>Configured Max Memory Limit</strong> =  <strong>total_memory<br />
</strong>这一项很重要，他是将各个缓存的大小累加，然后同max_connections相乘，从而得出当达到max_connections后需要分配的内存有多少。我这里由于max_connections写得很大，造成了最大内存限制超过了真实内存很多，所以建议不要随意增大max_connections的值。减小  max_connections的值，最终保证最大内存限制在真实内存的90%以下。</td>
</tr>
<tr>
<td valign="center">Physical Memory : 7.79 G</td>
<td valign="center">实际物理内存</td>
</tr>
<tr>
<td valign="center">Max memory limit exceeds 90% of physical memory</td>
<td valign="center"></td>
</tr>
<tr>
<td colspan="2" valign="center"><strong>per_thread_buffers<br />
</strong>(read_buffer_size+read_rnd_buffer_size  +sort_buffer_size+thread_stack+<br />
join_buffer_size+binlog_cache_size)*max_connections<strong>per_thread_max_buffers<br />
</strong>(read_buffer_size+read_rnd_buffer_size  +sort_buffer_size+thread_stack<br />
+join_buffer_size+binlog_cache_size)*max_used_connections<strong>global_buffers<br />
</strong>innodb_buffer_pool_size+innodb_additional_mem_pool_size+innodb_log_buffer_size+<br />
key_buffer_size+query_cache_size<strong>max_memory</strong>=global_buffers+per_thread_max_buffers</p>
<p><strong>total_memory</strong>=global_buffers+per_thread_buffers</td>
</tr>
<tr>
<td colspan="2" valign="center"></td>
</tr>
<tr>
<td valign="center"><strong>KEY BUFFER</strong></td>
<td valign="center"><strong>Key 缓冲</strong></td>
</tr>
<tr>
<td valign="center">Current MyISAM index space = 222 K</td>
<td valign="center">当前数据库MyISAM表中索引占用磁盘空间</td>
</tr>
<tr>
<td valign="center">Current key_buffer_size = 512 M</td>
<td valign="center">MySQL配置文件中key_buffer_size 设置的大小</td>
</tr>
<tr>
<td valign="center">Key cache miss rate is 1 : 3316</td>
<td valign="center">Key_read_requests/ Key_reads  这里说明3316次读取请求中有1次丢失(也就是说1次读取磁盘)</td>
</tr>
<tr>
<td valign="center">Key buffer free ratio = 81 %</td>
<td valign="center">key_blocks_unused * key_cache_block_size / key_buffer_size *  100</td>
</tr>
<tr>
<td valign="center"><strong>Your key_buffer_size seems to be fine</strong></td>
<td valign="center"></td>
</tr>
<tr>
<td colspan="2" valign="center"></td>
</tr>
<tr>
<td valign="center"><strong>QUERY CACHE</strong></td>
<td valign="center"><strong>Query 缓存</strong></td>
</tr>
<tr>
<td valign="center"><strong>Query cache is enabled</strong></td>
<td valign="center">该项说明 我们指定了query_cache_size  的值。如果query_cache_size=0的话这里给出的提示是：<br />
Query cache is supported but not  enabled<br />
Perhaps you should set the query_cache_size</td>
</tr>
<tr>
<td valign="center">Current query_cache_size = 64 M</td>
<td valign="center">当前系统query_cache_size 值大小 [F]</td>
</tr>
<tr>
<td valign="center">Current query_cache_used = 1 M</td>
<td valign="center"><strong>query_cache_used  =query_cache_size</strong>-<strong>qcache_free_memory </strong></td>
</tr>
<tr>
<td valign="center">Current query_cache_limit = 128 M</td>
<td valign="center">变量 query_cache_limit 大小</td>
</tr>
<tr>
<td valign="center">Current Query cache Memory fill ratio = 1.79 %</td>
<td valign="center"><strong>query_cache_used/</strong>query_cache_size  *100%</td>
</tr>
<tr>
<td valign="center">Current query_cache_min_res_unit = 4 K</td>
<td valign="center"><strong>show variables like  ‘query_cache_min_res_unit’;</strong></td>
</tr>
<tr>
<td valign="center"><strong>Your query_cache_size seems to be too high.<br />
Perhaps  you can use these resources elsewhere</strong></td>
<td valign="center">这项给出的结论是query_cache_size的值设置的有些过高。其比对标准是 “Query cache Memory  fill ratio”的值如果小于&lt;25%就会给出这个提示。可以将这些资源应用到其他的地方</td>
</tr>
<tr>
<td valign="center"><strong>MySQL won’t cache query results that are larger than  query_cache_limit in size</strong></td>
<td valign="center">MySQL不会将大于query_cache_limit的查询结果进行缓存</td>
</tr>
<tr>
<td colspan="2" valign="center">show status like ‘Qcache%’;Qcache_free_blocks         10<br />
Qcache_free_memory        65891984<br />
Qcache_hits             14437<br />
Qcache_inserts            707<br />
Qcache_lowmem_prunes     0<br />
Qcache_not_cached        216<br />
Qcache_queries_in_cache     540<br />
Qcache_total_blocks        1191</td>
</tr>
<tr>
<td colspan="2" valign="center"></td>
</tr>
<tr>
<td valign="center"><strong>SORT OPERATIONS</strong></td>
<td valign="center"><strong>SORT 选项</strong></td>
</tr>
<tr>
<td valign="center">Current sort_buffer_size = 6 M</td>
<td valign="center">show variables like ’sort_buffer%’;</td>
</tr>
<tr>
<td valign="center">Current read_rnd_buffer_size = 16 M</td>
<td valign="center">show variables like ‘read_rnd_buffer_size%’;</td>
</tr>
<tr>
<td valign="center">Sort buffer seems to be fine</td>
<td valign="center"></td>
</tr>
<tr>
<td colspan="2" valign="center"></td>
</tr>
<tr>
<td valign="center"><strong>JOINS</strong></td>
<td valign="center"><strong>JOINS</strong></td>
</tr>
<tr>
<td valign="center">Current join_buffer_size = 132.00 K</td>
<td valign="center"><strong>show variables like  ‘join_buffer_size%’;</strong><strong>join_buffer_size</strong>=<strong> join_buffer_size</strong>+4kb</td>
</tr>
<tr>
<td valign="center">You have had 6 queries where a join could not use an index  properly</td>
<td valign="center">这里的6是通过 <strong>show status like ‘Select_full_join’; </strong>获得的</td>
</tr>
<tr>
<td valign="center">You should enable “log-queries-not-using-indexes”<br />
Then look  for non indexed joins in the slow query log.<br />
If you are unable to optimize  your queries you may want to increase your<br />
join_buffer_size to accommodate  larger joins in one pass.Note! This script will still suggest raising the  join_buffer_size when<br />
ANY joins not using indexes are found.</td>
<td valign="center">你需要启用 “<strong>log-queries-not-using-indexes</strong>”  然后在慢查询日志中看是否有取消索引的joins语句。如果不优化查询语句的话，则需要增大<strong>join_buffer_size</strong>。</td>
</tr>
<tr>
<td colspan="2" valign="center"></td>
</tr>
<tr>
<td valign="center"><strong>OPEN FILES LIMIT</strong></td>
<td valign="center"><strong>文件打开数限制</strong></td>
</tr>
<tr>
<td valign="center">Current open_files_limit = 1234 files</td>
<td valign="center"><strong>show variables like  ‘open_files_limit%’;</strong></td>
</tr>
<tr>
<td valign="center">The open_files_limit should typically be set to at least  2x-3xthat of table_cache if you have heavy MyISAM usage.</td>
<td valign="center">如果系统中有很多的MyISAM类型的表，则建议将open_files_limit  设置为2X~3X的table_open_cache<br />
<strong>show status like  ‘Open_files’;</strong><strong>open_files_ratio</strong>=  open_files*100/open_files_limit<br />
如果<strong>open_files_ratio </strong>超过75%  则需要加大open_files_limit</td>
</tr>
<tr>
<td valign="center"><strong>Your open_files_limit value seems to be  fine</strong></td>
<td valign="center"></td>
</tr>
<tr>
<td colspan="2" valign="center"></td>
</tr>
<tr>
<td valign="center"><strong>TABLE CACHE</strong></td>
<td valign="center"><strong>TABLE 缓存</strong></td>
</tr>
<tr>
<td valign="center">Current table_open_cache = 512 tables</td>
<td valign="center">show variables like ‘table_open_cache’;</td>
</tr>
<tr>
<td valign="center">Current table_definition_cache = 256 tables</td>
<td valign="center">show variables like ‘ table_definition_cache ‘;</td>
</tr>
<tr>
<td valign="center">You have a total of 368 tables</td>
<td valign="center">SELECTCOUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE  TABLE_TYPE=’BASE TABLE’</td>
</tr>
<tr>
<td valign="center">You have <strong>371</strong> open tables.</td>
<td valign="center">show status like ‘Open_tables’;</td>
</tr>
<tr>
<td valign="center"><strong>The table_cache value seems to be fine</strong></td>
<td valign="center"><strong>Open_tables</strong> /<strong>table_open_cache*100%</strong> &lt; 95%</td>
</tr>
<tr>
<td valign="center"><strong>You should probably increase your  table_definition_cache value.</strong></td>
<td valign="center"><strong>table_cache_hit_rate</strong> =open_tables*100/opened_tables</td>
</tr>
<tr>
<td colspan="2" valign="center"></td>
</tr>
<tr>
<td valign="center"><strong>TEMP TABLES</strong></td>
<td valign="center"><strong>临时表</strong></td>
</tr>
<tr>
<td valign="center">Current max_heap_table_size = 16 M</td>
<td valign="center">show variables like ‘max_heap_table_size’;</td>
</tr>
<tr>
<td valign="center">Current tmp_table_size = 16 M</td>
<td valign="center">show variables like ‘tmp_table_size’;</td>
</tr>
<tr>
<td valign="center">Of 285 temp tables, 11% were created on disk</td>
<td valign="center">Created_tmp_tables=285created_tmp_disk_tables*100/<br />
(created_tmp_tables+created_tmp_disk_tables)=11%</td>
</tr>
<tr>
<td valign="center"><strong>Created disk tmp tables ratio seems fine</strong></td>
<td valign="center"></td>
</tr>
<tr>
<td colspan="2" valign="center"></td>
</tr>
<tr>
<td valign="center"><strong>TABLE SCANS</strong></td>
<td valign="center"><strong>扫描表</strong></td>
</tr>
<tr>
<td valign="center">Current read_buffer_size = 6 M</td>
<td valign="center">show variables like ‘read_buffer_size’;</td>
</tr>
<tr>
<td valign="center">Current table scan ratio = 9 : 1</td>
<td valign="center"><strong>read_rnd_next</strong> =show global status like  ‘Handler_read_rnd_next’;<br />
<strong>com_select</strong>= show global status like  ‘Com_select’;<br />
<strong>full_table_scans</strong>=read_rnd_next/com_select<br />
<strong>Current  table scan ratio</strong> = full_table_scans :  1″<br />
如果表扫描率超过4000，说明进行了太多表扫描，很有可能索引没有建好，增加read_buffer_size值会有一些好处，但最好不要超过8MB。</td>
</tr>
<tr>
<td valign="center"><strong>read_buffer_size seems to be fine</strong></td>
<td valign="center"></td>
</tr>
<tr>
<td colspan="2" valign="center"></td>
</tr>
<tr>
<td valign="center"><strong>TABLE LOCKING</strong></td>
<td valign="center"><strong>TABLE LOCKING</strong></td>
</tr>
<tr>
<td valign="center">Current Lock Wait ratio = 0 : 5617</td>
<td valign="center">show global status like’Table_locks_waited’;<br />
show global  status like‘Questions’;<br />
如果 Table_locks_waited=0<br />
Current Lock Wait ratio = 0:  Questions</td>
</tr>
<tr>
<td valign="center"><strong>Your table locking seems to be fine</strong></td>
<td valign="center"></td>
</tr>
</tbody>
</table>
</div>
<div></div>
<div></div>
<div>转载自：http://blog.chinaunix.net/u3/117634/showart_2291084.html</div>
]]></content:encoded>
			<wfw:commentRss>http://www.187299.com/archives/1653/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL：how to ignore errors loading a dump</title>
		<link>http://www.187299.com/archives/1642</link>
		<comments>http://www.187299.com/archives/1642#comments</comments>
		<pubDate>Mon, 09 Aug 2010 05:29:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.187299.com/?p=1642</guid>
		<description><![CDATA[When we load a dump sql file using the following command: mysql -uroot -pdbpassword test &#60; /data/mysql.sql the procedure will stop as it detects an error. How to make procedure ignore the errors and continue anyway? There are two kinds of methond can... ]]></description>
			<content:encoded><![CDATA[<p>When we load a dump sql file using the following command:<br />
mysql -uroot -pdbpassword test &lt; /data/mysql.sql<br />
the procedure will stop as it detects an error.<br />
How to make procedure ignore the errors and continue anyway?<br />
There are two kinds of methond can do that.</p>
<p>The first one:use "-f" option<br />
mysql -uroot -pdbpassword -f test &lt; /data/mysql.sql</p>
<p>The second one:access into mysql,and use the "source" command.<br />
mysql -uroot -pdbpassword test<br />
source /data/mysql.sql<br />
exit</p>
<p>References:</p>
<p>http://forums.mysql.com/read.php?28,78316,78316</p>
]]></content:encoded>
			<wfw:commentRss>http://www.187299.com/archives/1642/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用mysqldump線上備份InnoDB</title>
		<link>http://www.187299.com/archives/1493</link>
		<comments>http://www.187299.com/archives/1493#comments</comments>
		<pubDate>Fri, 05 Mar 2010 03:08:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.187299.com/?p=1493</guid>
		<description><![CDATA[用 mysqldump 做線上即時備份，通常 InnoDB 的資料只有出現1~2筆，如果要儘可能把完整的資料匯出，可以加上 --single-transaction，備份前 mysqldump 會先執行 BEGIN ，取得 READ LOCK 後，便能確定資料在執... ]]></description>
			<content:encoded><![CDATA[<p>用 mysqldump 做線上即時備份，通常 InnoDB 的資料只有出現1~2筆，如果要儘可能把完整的資料匯出，可以加上 --single-transaction，備份前 mysqldump 會先執行 BEGIN ，取得 READ LOCK 後，便能確定資料在執行 mysqldump 的過程中不會受到其它連線對 InnoDB 存取的干擾，也能 Dump 出較完整的資料。(使用此參數需有 READ LOCK 權限)</p>
<p>mysqldump --single-transaction --all-databases &gt; all_db.sql</p>
<p>注意:<br />
1.表單較大時可以加上 --quick<br />
2.MySQL Cluster 不支援 --single-transaction</p>
<p>然而使用 --single-transaction 時最好搭配 --flush-logs 及 --master-data 來維持 Binary Log 的完整性。(使用這二個參數皆需有 RELOAD 權限)</p>
<p>mysqldump --single-transaction --flush-logs --master-data --all-databases &gt; all_db.sql</p>
<p>Binary Log 採用的是遞增備份，--flush-logs 便是把目前的 Binary Log 給 flush 出來 (若目前 MASTER_LOG_FILE 已經到 mysql-bin.000005，產生出來的檔案便是 mysql-bin.000006)，完成之後才進行 Dump 的作業。</p>
<p>而 --master-data (預設值為1) 則是在 Dump 出來的 SQL 語法中加入下面這一行，以記錄目前 Dump 的時間點。</p>
<p>CHANGE MASTER TO MASTER_LOG_FILE=mysql-bin.000006',MASTER_LOG_POS=4;</p>
<p>如果在未來執行匯入時 SQL 語法時， MySQL 便能很清楚的知道這次 Dump 出來的 SQL 在 Binary Log 中是屬於哪個位置。</p>
<p>註: 若不需理會 Binary Log 的位置時 (例如進行完整備份作業)，只要將 --master-data 設為 2 便會將 CHANGE MASTER 給註解起來純供參考用。</p>
<p>转载自：<a href="http://www.neo.com.tw/archives/1122" target="_blank">http://www.neo.com.tw/archives/1122 </a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.187299.com/archives/1493/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL – Got a packet bigger than ‘max_allowed_packet’</title>
		<link>http://www.187299.com/archives/1448</link>
		<comments>http://www.187299.com/archives/1448#comments</comments>
		<pubDate>Mon, 25 Jan 2010 02:40:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.187299.com/?p=1448</guid>
		<description><![CDATA[The default maximum allowed packget size is 1MB, so if you store some large binaries in your database you might get some problems. All you need to do is re-set the maximum size to a larger number. Macintosh:trunk jennyfong$ mysql -uroot database_name &#6... ]]></description>
			<content:encoded><![CDATA[<p>The default maximum allowed packget size is 1MB, so if you store some large binaries in your database you might get some problems. All you need to do is re-set the maximum size to a larger number.</p>
<p>Macintosh:trunk jennyfong$ mysql -uroot database_name &lt; database_backup.sql</p>
<p>ERROR 1153 (08S01) at line 2365: Got a packet bigger than 'max_allowed_packet' bytes<br />
Macintosh:trunk jennyfong$ mysql -uroot<br />
Welcome to the MySQL monitor.  Commands end with ; or \g.<br />
Your MySQL connection id is 25<br />
Server version: 5.0.86 MySQL Community Server (GPL)</p>
<p>Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.</p>
<p>mysql&gt; set global net_buffer_length=10000000;<br />
Query OK, 0 rows affected, 1 warning (0.00 sec)</p>
<p>mysql&gt; set global max_allowed_packet=1000000000;<br />
Query OK, 0 rows affected (0.00 sec)</p>
<p>mysql&gt; exit<br />
Bye<br />
Macintosh:trunk jennyfong$ mysql -uroot database_name &lt; database_backup.sql</p>
<p>show variables like 'max_allowed_packet';</p>
]]></content:encoded>
			<wfw:commentRss>http://www.187299.com/archives/1448/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>install_xtrabackup-1.0_on_CentOS_5.4</title>
		<link>http://www.187299.com/archives/1436</link>
		<comments>http://www.187299.com/archives/1436#comments</comments>
		<pubDate>Wed, 06 Jan 2010 13:11:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.187299.com/?p=1436</guid>
		<description><![CDATA[wget http://www.percona.com/mysql/xtrabackup/1.0/source/xtrabackup-1.0-56.rhel5.src.rpm mkdir -p /usr/src/redhat/SOURCES/ rpm -i xtrabackup-1.0-56.rhel5.src.rpm cd /usr/src/redhat/SOURCES/ tar xf xtrabackup-1.0.tar.gz cd xtrabackup-1.0 ./configure make c... ]]></description>
			<content:encoded><![CDATA[<p>wget http://www.percona.com/mysql/xtrabackup/1.0/source/xtrabackup-1.0-56.rhel5.src.rpm<br />
mkdir -p /usr/src/redhat/SOURCES/<br />
rpm -i xtrabackup-1.0-56.rhel5.src.rpm<br />
cd /usr/src/redhat/SOURCES/<br />
tar xf xtrabackup-1.0.tar.gz<br />
cd xtrabackup-1.0<br />
./configure<br />
make<br />
cd innobase/xtrabackup/<br />
make<br />
make install</p>
<p>/usr/bin/innobackupex-1.5.1 --help</p>
]]></content:encoded>
			<wfw:commentRss>http://www.187299.com/archives/1436/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Got error 28 from storage engine 解决方法</title>
		<link>http://www.187299.com/archives/1380</link>
		<comments>http://www.187299.com/archives/1380#comments</comments>
		<pubDate>Tue, 08 Dec 2009 11:10:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://www.187299.com/?p=1380</guid>
		<description><![CDATA[今天碰到数据库出错 Got error 28 from storage engine 查了一下，数据库文件所在的盘应该没事，应该是数据库用的临时目录空间不够 引用 磁盘临时空间不够导致。 解决办法： 清空/tmp目录，或者修... ]]></description>
			<content:encoded><![CDATA[<p>今天碰到数据库出错</p>
<p>Got error 28 from storage engine</p>
<p>查了一下，数据库文件所在的盘应该没事，应该是数据库用的临时目录空间不够</p>
<p>引用<br />
磁盘临时空间不够导致。<br />
解决办法：<br />
清空/tmp目录，或者修改my.cnf中的tmpdir参数，指向具有足够空间目录</p>
<p>上面的说法应该比较清楚，还有一个类似的：</p>
<p>引用<br />
mysql报以下错的解决方法</p>
<p>ERROR 1030 (HY000): Got error 28 from storage engine</p>
<p>出现此问题的原因：临时空间不够，无法执行此SQL语句</p>
<p>解决方法：将tmpdir指向一个硬盘空间很大的目录即可</p>
<p>原创内容如转载请注明：来自 阿权的书房<br />
本帖地址：<a href="http://www.aslibra.com/blog/read.php/794.htm" target="_blank">http://www.aslibra.com/blog/read.php/794.htm</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.187299.com/archives/1380/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

