<?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://zhoumo123.cn/tag/mysql%e4%b8%b4%e6%97%b6%e6%96%87%e4%bb%b6/feed" rel="self" type="application/rss+xml" />
	<link>http://zhoumo123.cn</link>
	<description>知识分享，共同进步。zhoumo123.cn</description>
	<lastBuildDate>Thu, 07 Nov 2019 05:53:49 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.0.1</generator>
	<item>
		<title>mysql查大数据时报错Incorrect key file for table &#8216;/tmp/#sql&#8230;&#039;; try to repair it&#8217; in &#8230;</title>
		<link>http://zhoumo123.cn/mysql/3417.html</link>
		<comments>http://zhoumo123.cn/mysql/3417.html#comments</comments>
		<pubDate>Wed, 09 Dec 2015 01:40:18 +0000</pubDate>
		<dc:creator><![CDATA[zhangc]]></dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql临时文件]]></category>

		<guid isPermaLink="false">http://zhoumo123.cn/?p=3417</guid>
		<description><![CDATA[今天在php mysql查大数据时报错，&#60;b&#62;Fatal error&#60;/b&#62;: Uncaught exception &#8216;PDOException&#8217; with message &#8216;SQLSTATE[HY000]: General error:126 Incorrect key file for table &#8216;/tmp/#sql_72c_0.MYI'; try to repair it&#8217; in &#8230; 当mysql的临时文件大小设置太小，或者由于并发量太大导致临时文件存放的目录空间大小不够时都会报这个错误。&#038; ...  <a href="http://zhoumo123.cn/mysql/3417.html">  阅读全文 </a>]]></description>
				<content:encoded><![CDATA[<p>今天在php mysql查大数据时报错，&lt;b&gt;Fatal error&lt;/b&gt;: Uncaught exception &#8216;PDOException&#8217; with message &#8216;SQLSTATE[HY000]: General error:126 Incorrect key file for table &#8216;/tmp/#sql_72c_0.MYI'; try to repair it&#8217; in &#8230;</p>
<p><a href="http://zhoumo123.cn/wp-content/uploads/2015/12/tmp-err1.jpg"><img class="alignnone size-full wp-image-3418" src="http://zhoumo123.cn/wp-content/uploads/2015/12/tmp-err1.jpg" alt="tmp-err1" width="690" height="159" /></a><br />
当mysql的临时文件大小设置太小，或者由于并发量太大导致临时文件存放的目录空间大小不够时都会报这个错误。&#8221;incorrect key file for the table &#8216;/tmp/#sql&#8230;.';try to repair it&#8221;</p>
<p>一般的tmp目录的权限比较特别是drwxrwxrwt 就是1777<br />
表示任何人都可以在此目录拥有写权限但是不能删除别人拥有的文件。</p>
<p>d:指的是目录<br />
t:sticky bit，设置了粘住位</p>
<p><strong>具体修改临时表目录的步骤为：</strong></p>
<p><strong>1)</strong> <strong>查看法语站当前磁盘空间使用情况，建议将临时表存放目录设置在/var下。</strong></p>
<p><a href="http://zhoumo123.cn/wp-content/uploads/2015/12/tmp-err2.jpg"><img class="alignnone size-full wp-image-3419" src="http://zhoumo123.cn/wp-content/uploads/2015/12/tmp-err2.jpg" alt="tmp-err2" width="546" height="111" /></a><br />
【修改tmp目录】Incorrect &lt;wbr&gt;key &lt;wbr&gt;file &lt;wbr&gt;for &lt;wbr&gt;table &lt;wbr&gt;&#8217;/tmp/#sql_bd2_0.MYI&#8217;解决<br />
[root@wholesale /]# <span style="color: #0000ff;">mkdir /var/tmp</span><br />
[root@wholesale /]# <span style="color: #0000ff;">chmod 1777 /var/tmp/</span><br />
<strong>2) my.cnf中[mysqld]下增加：</strong></p>
<p><span style="color: #0000ff;">tmpdir=/var/tmp</span></p>
<p><strong>3) 重启mysql服务</strong><br />
<strong>4) 查看mysql错误日志情况，看是否报错。</strong><br />
<strong>5) 进入mysql查看当前的tmpdir情况，确认是否修改完成</strong><br />
<span style="color: #0000ff;">show variables like &#8216;tmpdir';</span></p>
<p><a href="http://zhoumo123.cn/wp-content/uploads/2015/12/tmp-err3.jpg"><img class="alignnone size-full wp-image-3420" src="http://zhoumo123.cn/wp-content/uploads/2015/12/tmp-err3.jpg" alt="tmp-err3" width="560" height="100" /></a></p>
<p>http://blog.sina.com.cn/s/blog_4c197d420101bdn9.html</p>
]]></content:encoded>
			<wfw:commentRss>http://zhoumo123.cn/mysql/3417.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysql数据库错误 General error: Error writing file &#8216;/tmp/&#8230;&#8217; (Errcode: 28)</title>
		<link>http://zhoumo123.cn/mysql/3209.html</link>
		<comments>http://zhoumo123.cn/mysql/3209.html#comments</comments>
		<pubDate>Mon, 24 Aug 2015 03:49:50 +0000</pubDate>
		<dc:creator><![CDATA[zhangc]]></dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql临时文件]]></category>

		<guid isPermaLink="false">http://zhoumo123.cn/?p=3209</guid>
		<description><![CDATA[在php mysql 查询大数据时，遇到了一个错误 Fatal error: Uncaught exception &#8216;PDOException&#8217; with message &#8216;SQLSTATE[HY000]: General error: 3 Error writing file &#8216;/tmp/&#8230;&#8230;&#8217; (Errcode: 28)&#8217; in &#8230;&#8230; 。 通过搜索发现这个问题是mysql查询创建临时文件时，临时目录的空间不足导致的。 这个错误如果想看到它的现象，就必须在sql运行时来监视 ...  <a href="http://zhoumo123.cn/mysql/3209.html">  阅读全文 </a>]]></description>
				<content:encoded><![CDATA[<p>在php mysql 查询大数据时，遇到了一个错误 <b>Fatal error</b>: Uncaught exception &#8216;PDOException&#8217; with message &#8216;SQLSTATE[HY000]: General error: 3 Error writing file &#8216;/tmp/&#8230;&#8230;&#8217; (Errcode: 28)&#8217; in &#8230;&#8230; 。</p>
<p>通过搜索发现这个问题是mysql查询创建临时文件时，临时目录的空间不足导致的。</p>
<p>这个错误如果想看到它的现象，就必须在sql运行时来监视这个临时文件夹的大小，就可以看到mysql在/tmp下创建了一个临时文件，这个临时文件的大小取决于sql语句以及表的大小。</p>
<p>解决方法：配置临时文件大小</p>
<p>参考</p>
<p>http://blog.sina.com.cn/s/blog_69bd80940100n8dc.html</p>
]]></content:encoded>
			<wfw:commentRss>http://zhoumo123.cn/mysql/3209.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
