<?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>PlanetMysql.ru - информация о СУБД MySQL &#187; errcode</title>
	<atom:link href="http://planetmysql.ru/category/errcode/feed/" rel="self" type="application/rss+xml" />
	<link>http://planetmysql.ru</link>
	<description>Блог о самой популярной СУБД MySQL</description>
	<lastBuildDate>Fri, 10 Feb 2012 22:53:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>How To Fix Intermittent MySQL Errcode 13 Errors On Windows</title>
		<link>http://beerpla.net/2010/01/05/how-to-fix-intermittent-mysql-errcode-13-errors-on-windows/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-fix-intermittent-mysql-errcode-13-errors-on-windows</link>
		<comments>http://beerpla.net/2010/01/05/how-to-fix-intermittent-mysql-errcode-13-errors-on-windows/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 10:49:33 +0000</pubDate>
		<dc:creator>Artem Russakovskii</dc:creator>
				<category><![CDATA[13]]></category>
		<category><![CDATA[Databases]]></category>
		<category><![CDATA[errcode]]></category>
		<category><![CDATA[errcode 13]]></category>
		<category><![CDATA[Error]]></category>
		<category><![CDATA[mcafee]]></category>
		<category><![CDATA[microsoft security essentials]]></category>
		<category><![CDATA[myd]]></category>
		<category><![CDATA[myi]]></category>
		<category><![CDATA[myisam]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://beerpla.net/2010/01/05/how-to-fix-intermittent-mysql-errcode-13-errors-on-windows/</guid>
		<description><![CDATA[ 
The Problem
I&#39;ve had MySQL on my Windows 7 laptop for a bit (as part of wampserver), mostly for local offline Wordpress development.
However, even though MySQL is relatively stable, I&#39;ve been observing a vast quantity of intermittent MySQL errors, as reported by Wordpress in the PHP error log (C:\wamp\logs\php_error.log). Here are some examples:

[05-Jan-2010 09:47:51] WordPress database error Error on delete of
'C:\Windows\TEMP\#sql17e0_1a2_6.MYD' (Errcode: 13) for query SELECT t.*, tt.* 
FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id 
INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = 
tt.term_taxonomy_id WHERE tt.taxonomy IN ('category') AND tr.object_id IN (3) 
ORDER BY t.name ASC made by require, require_once, include, get_footer, 
locate_template, load_template, require_once, dynamic_sidebar, 
call_user_func_array, widget_rrm_recent_posts, RecentPosts-&#62;execute, 
ppl_expand_template, otf_categorylinks, get_the_category, wp_get_object_terms
&#160;
[05-Jan-2010 09:50:42] WordPress database error Error on delete of
'C:\Windows\TEMP\#sql17e0_1b0_0.MYD' (Errcode: 13) for query  SELECT 
SQL_CALC_FOUND_ROWS  wp_posts.* FROM wp_posts  INNER JOIN wp_term_relationships 
ON (wp_posts.ID = wp_term_relationships.object_id) INNER JOIN wp_term_taxonomy ON 
(wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id)  
WHERE 1=1  AND wp_term_taxonomy.taxonomy = 'category' AND 
wp_term_taxonomy.term_id IN ('3') AND wp_posts.post_type = 'post' AND 
(wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') GROUP BY 
wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 10 made by require, wp, 
WP-&#62;main, WP-&#62;query_posts, WP_Query-&#62;query, WP_Query-&#62;get_posts

The important part here is &#34;Errcode: 13&#34;, which is a file access error. The MySQL daemon process (mysqld.exe) randomly cannot access temporary tables it itself creates, which causes these errors and failed queries. 
Digging Around
After looking around and finding nothing obvious, I tracked down a few forum posts mentioning the same issue.
Here is the gist &#8211; the problem is caused by an anti-virus program that is clearly not working properly.
The one mentioned on the forums is McAfee (big surprise, right? McAfee is a piece of junk &#8211; probably the worst anti-virus I&#39;ve ever tried). In my case, however, it was the recently installed freeware security program from Microsoft called Microsoft Security Essentials, highly praised but problematic in this case nonetheless.
After thinking about it, I am confident that these security programs don&#39;t actually purposely prohibit access to the files MySQL creates. Instead, they lock these files for the duration of the check, so that the system doesn&#39;t get infected before they are approved. If you notice, the problems are related to temporary tables, created by MySQL on the fly. MySQL probably has a very short access timeout for these files, for performance reasons, and because it doesn&#39;t get this access fast enough, it considers it a failure (file deletions are failing, as you can see in the log).
The Solution
Now onto fixing the problem. The solution is to have Microsoft Security Essentials, in my case, or whatever your security program may be ignore these files.
You can block the whole Temp directory from being checked. It is not a good idea, as viruses can trickle down to that location and bypass your anti-virus:
 
Instead, you should just ignore by file extension: *.MYI and *.MYD. MySQL uses files with these extensions for its MyISAM table types. Using this approach is obviously safer as it doesn&#39;t single out a directory and instead targets specific files:

After I applied either of these exclusions, all MySQL Error 13 problems went away immediately.
Conclusion
The intermittent Error 13 problem on Windows is caused by 2 otherwise legitimate processes which, when mixed together, end up breaking MySQL.
Is this entirely the fault of the antivirus programs? Inadvertently, perhaps so.
Could MySQL be a bit smarter in this scenario? Perhaps so as well.
What do you, MySQL pros, think?





		
			Tweet This!
		
		
			Share this on del.icio.us
		
		
			Digg this!
		
		
			Share this on Reddit
		
		
			Stumble upon something good? Share it on StumbleUpon
		
		
			Share this on Facebook
		
		
			Share this on Linkedin
		
		
			Email this to a friend?
		





Similar Posts:MySQL Conference Liveblogging: EXPLAIN Demystified (Tuesday 2:00PM)

Swapping Column Values in MySQL

MySQL Conference Liveblogging: Benchmarking Tools (Wednesday 4:25PM)

[MySQL] Deleting/Updating Rows Common To 2 Tables &#8211; Speed And Slave Lag Considerations

Beer Planet Upgraded To Wordpress 2.5
]]></description>
			<content:encoded><![CDATA[<p><img style="margin: 0px 10px 10px 0px; display: inline" title="13" alt="13" align="left" src="http://beerpla.net/wp-content/uploads/HowToFixIntermittentMySQLErrcode13Errors_1A77/image.png" width="150" height="150" /> </p>
<h2>The Problem</h2>
<p>I&#039;ve had MySQL on my Windows 7 laptop for a bit (as part of <a href="http://www.wampserver.com/en/" rel="nofollow" >wampserver</a>), mostly for local offline Wordpress development.</p>
<p>However, even though MySQL is relatively stable, I&#039;ve been observing a vast quantity of intermittent MySQL errors, as reported by Wordpress in the PHP error log (C:\wamp\logs\php_error.log). Here are some examples:</p>

<div><div><pre>[05-Jan-2010 09:47:51] WordPress database error Error on delete of
'C:\Windows\TEMP\#sql17e0_1a2_6.MYD' (Errcode: 13) for query SELECT t.*, tt.* 
FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id 
INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = 
tt.term_taxonomy_id WHERE tt.taxonomy IN ('category') AND tr.object_id IN (3) 
ORDER BY t.name ASC made by require, require_once, include, get_footer, 
locate_template, load_template, require_once, dynamic_sidebar, 
call_user_func_array, widget_rrm_recent_posts, RecentPosts-&gt;execute, 
ppl_expand_template, otf_categorylinks, get_the_category, wp_get_object_terms
&nbsp;
[05-Jan-2010 09:50:42] WordPress database error Error on delete of
'C:\Windows\TEMP\#sql17e0_1b0_0.MYD' (Errcode: 13) for query  SELECT 
SQL_CALC_FOUND_ROWS  wp_posts.* FROM wp_posts  INNER JOIN wp_term_relationships 
ON (wp_posts.ID = wp_term_relationships.object_id) INNER JOIN wp_term_taxonomy ON 
(wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id)  
WHERE 1=1  AND wp_term_taxonomy.taxonomy = 'category' AND 
wp_term_taxonomy.term_id IN ('3') AND wp_posts.post_type = 'post' AND 
(wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') GROUP BY 
wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 10 made by require, wp, 
WP-&gt;main, WP-&gt;query_posts, WP_Query-&gt;query, WP_Query-&gt;get_posts</pre></div></div>

<p>The important part here is &quot;Errcode: 13&quot;, which is a file access error. The MySQL daemon process (mysqld.exe) randomly cannot access temporary tables it itself creates, which causes these errors and failed queries. </p>
<h2>Digging Around</h2>
<p>After looking around and finding nothing obvious, I tracked down a few forum posts mentioning the same issue.</p>
<p>Here is the gist &#8211; the problem is caused by an anti-virus program that is clearly not working properly.</p>
<p>The one mentioned on the forums is McAfee (big surprise, right? McAfee is a piece of junk &#8211; probably the worst anti-virus I&#039;ve ever tried). In my case, however, it was the recently installed freeware security program from Microsoft called <a href="http://www.microsoft.com/Security_Essentials/" rel="nofollow" >Microsoft Security Essentials</a>, highly praised but problematic in this case nonetheless.</p>
<p>After thinking about it, I am confident that these security programs don&#039;t actually purposely prohibit access to the files MySQL creates. Instead, they lock these files for the duration of the check, so that the system doesn&#039;t get infected before they are approved. If you notice, the problems are related to temporary tables, created by MySQL on the fly. MySQL probably has a very short access timeout for these files, for performance reasons, and because it doesn&#039;t get this access fast enough, it considers it a failure (file deletions are failing, as you can see in the log).</p>
<h2>The Solution</h2>
<p>Now onto fixing the problem. The solution is to have Microsoft Security Essentials, in my case, or whatever your security program may be ignore these files.</p>
<p>You can block the whole Temp directory from being checked. It is not a good idea, as viruses can trickle down to that location and bypass your anti-virus:</p>
<p><a href="http://beerpla.net/wp-content/uploads/HowToFixIntermittentMySQLErrcode13Errors_1A77/image_3.png"><img style="display: block; float: none; margin-left: auto; margin-right: auto" title="Ignore Windows Temp dir in Microsoft Security Essentials" alt="Ignore Windows Temp dir in Microsoft Security Essentials" src="http://beerpla.net/wp-content/uploads/HowToFixIntermittentMySQLErrcode13Errors_1A77/image_thumb.png" width="700" height="545" /></a> </p>
<p>Instead, you should just ignore by file extension: *.MYI and *.MYD. MySQL uses files with these extensions for its MyISAM table types. Using this approach is obviously safer as it doesn&#039;t single out a directory and instead targets specific files:</p>
<p><a href="http://beerpla.net/wp-content/uploads/HowToFixIntermittentMySQLErrcode13Errors_1A77/image_4.png"><img style="display: block; float: none; margin-left: auto; margin-right: auto" title="Ignore *.MYI and *.MYD in Microsoft Security Essentials" alt="Ignore *.MYI and *.MYD in Microsoft Security Essentials" src="http://beerpla.net/wp-content/uploads/HowToFixIntermittentMySQLErrcode13Errors_1A77/image_thumb_3.png" width="700" height="545" /></a></p>
<p>After I applied either of these exclusions, all MySQL Error 13 problems went away immediately.</p>
<h2>Conclusion</h2>
<p>The intermittent Error 13 problem on Windows is caused by 2 otherwise legitimate processes which, when mixed together, end up breaking MySQL.</p>
<p>Is this entirely the fault of the antivirus programs? Inadvertently, perhaps so.</p>
<p>Could MySQL be a bit smarter in this scenario? Perhaps so as well.</p>
<p>What do you, MySQL pros, think?</p>


<!-- Begin SexyBookmarks Menu Code -->
<div>
<ul>
		<li>
			<a href="http://twitter.com/home?status=How+To+Fix+Intermittent+MySQL+Errcode+13+Errors+On+Windows+-+http://tinyurl.com/yjx26m8+(via+@ArtemR)" rel="nofollow" title="Tweet This!">Tweet This!</a>
		</li>
		<li>
			<a href="http://del.icio.us/post?url=http://beerpla.net/2010/01/05/how-to-fix-intermittent-mysql-errcode-13-errors-on-windows/&amp;title=How+To+Fix+Intermittent+MySQL+Errcode+13+Errors+On+Windows" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li>
			<a href="http://digg.com/submit?phase=2&amp;url=http://beerpla.net/2010/01/05/how-to-fix-intermittent-mysql-errcode-13-errors-on-windows/&amp;title=How+To+Fix+Intermittent+MySQL+Errcode+13+Errors+On+Windows" rel="nofollow" title="Digg this!">Digg this!</a>
		</li>
		<li>
			<a href="http://reddit.com/submit?url=http://beerpla.net/2010/01/05/how-to-fix-intermittent-mysql-errcode-13-errors-on-windows/&amp;title=How+To+Fix+Intermittent+MySQL+Errcode+13+Errors+On+Windows" rel="nofollow" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li>
			<a href="http://www.stumbleupon.com/submit?url=http://beerpla.net/2010/01/05/how-to-fix-intermittent-mysql-errcode-13-errors-on-windows/&amp;title=How+To+Fix+Intermittent+MySQL+Errcode+13+Errors+On+Windows" rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li>
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://beerpla.net/2010/01/05/how-to-fix-intermittent-mysql-errcode-13-errors-on-windows/&amp;t=How+To+Fix+Intermittent+MySQL+Errcode+13+Errors+On+Windows" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li>
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://beerpla.net/2010/01/05/how-to-fix-intermittent-mysql-errcode-13-errors-on-windows/&amp;title=How+To+Fix+Intermittent+MySQL+Errcode+13+Errors+On+Windows&amp;summary=%20%20%20The%20Problem%20%20I've%20had%20MySQL%20on%20my%20Windows%207%20laptop%20for%20a%20bit%20(as%20part%20of%20wampserver),%20mostly%20for%20local%20offline%20Wordpress%20development.%20%20However,%20even%20though%20MySQL%20is%20relatively%20stable,%20I've%20been%20observing%20a%20vast%20quantity%20of%20intermittent%20MySQL%20errors,%20as%20reported%20by%20Wordpress%20in%20the%20PHP%20error%20log%20(&amp;source=beer%20planet" rel="nofollow" title="Share this on Linkedin">Share this on Linkedin</a>
		</li>
		<li>
			<a href="mailto:?subject=%22How%20To%20Fix%20Intermittent%20MySQL%20Errcode%2013%20Errors%20On%20Windows%22&amp;body=I%20thought%20this%20article%20might%20interest%20you.%0A%0A%22%20%20%20The%20Problem%20%20I've%20had%20MySQL%20on%20my%20Windows%207%20laptop%20for%20a%20bit%20(as%20part%20of%20wampserver),%20mostly%20for%20local%20offline%20Wordpress%20development.%20%20However,%20even%20though%20MySQL%20is%20relatively%20stable,%20I've%20been%20observing%20a%20vast%20quantity%20of%20intermittent%20MySQL%20errors,%20as%20reported%20by%20Wordpress%20in%20the%20PHP%20error%20log%20(%22%0A%0AYou%20can%20read%20the%20full%20article%20here:%20http://beerpla.net/2010/01/05/how-to-fix-intermittent-mysql-errcode-13-errors-on-windows/" rel="nofollow" title="Email this to a friend?">Email this to a friend?</a>
		</li>
</ul>
<div></div>
</div>
<!-- End SexyBookmarks Menu Code -->

Similar Posts:<ul><li><a href="http://beerpla.net/2008/04/15/mysql-conference-liveblogging-explain-demystified-tuesday-200p/" rel="bookmark" title="April 15, 2008">MySQL Conference Liveblogging: EXPLAIN Demystified (Tuesday 2:00PM)</a></li>

<li><a href="http://beerpla.net/2009/02/17/swapping-column-values-in-mysql/" rel="bookmark" title="February 17, 2009">Swapping Column Values in MySQL</a></li>

<li><a href="http://beerpla.net/2008/04/16/mysql-conference-liveblogging-benchmarking-tools-wednesday-425pm/" rel="bookmark" title="April 16, 2008">MySQL Conference Liveblogging: Benchmarking Tools (Wednesday 4:25PM)</a></li>

<li><a href="http://beerpla.net/2009/05/11/mysql-deletingupdating-rows-common-to-2-tables-speed-and-slave-lag-considerations/" rel="bookmark" title="May 11, 2009">[MySQL] Deleting/Updating Rows Common To 2 Tables &#8211; Speed And Slave Lag Considerations</a></li>

<li><a href="http://beerpla.net/2008/03/29/beer-planet-upgraded-to-wordpress-25/" rel="bookmark" title="March 29, 2008">Beer Planet Upgraded To Wordpress 2.5</a></li>
</ul><!-- Similar Posts took 40.624 ms --><a href="http://www.addtoany.com/share_save?linkurl=http://beerpla.net/2010/01/05/how-to-fix-intermittent-mysql-errcode-13-errors-on-windows/&amp;linkname=How%20To%20Fix%20Intermittent%20MySQL%20Errcode%2013%20Errors%20On%20Windows"><img src="http://beerpla.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark" /></a><br/>PlanetMySQL Voting:
	 <a href="http://planet.mysql.com/entry/vote/?entry_id=22891&vote=1&apivote=1">Vote UP</a> /
	 <a href="http://planet.mysql.com/entry/vote/?entry_id=22891&vote=-1&apivote=1">Vote DOWN</a>]]></content:encoded>
			<wfw:commentRss>http://planetmysql.ru/2010/01/05/how-to-fix-intermittent-mysql-errcode-13-errors-on-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

