<?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>MySQL Slow Query &#8211; lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</title>
	<atom:link href="https://lifelinux.com/tag/mysql-slow-query/feed/" rel="self" type="application/rss+xml" />
	<link>https://lifelinux.com</link>
	<description>All About Linux !</description>
	<lastBuildDate>Sun, 08 May 2011 11:29:54 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.5.3</generator>
	<item>
		<title>MySQL Slow Query Log File</title>
		<link>https://lifelinux.com/mysql-slow-query-log-file/</link>
					<comments>https://lifelinux.com/mysql-slow-query-log-file/#respond</comments>
		
		<dc:creator><![CDATA[lifeLinux]]></dc:creator>
		<pubDate>Sun, 08 May 2011 11:27:47 +0000</pubDate>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[/etc/my.cnf]]></category>
		<category><![CDATA[enable log slow query]]></category>
		<category><![CDATA[estart mysql service]]></category>
		<category><![CDATA[long_query_time]]></category>
		<category><![CDATA[my.cnf]]></category>
		<category><![CDATA[MySQL Slow Query]]></category>
		<category><![CDATA[mysql-slow-queries]]></category>
		<category><![CDATA[mysqld restart]]></category>
		<category><![CDATA[vi command]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=349</guid>

					<description><![CDATA[<p>The slow query log consists of all SQL statements that took more than long_query_time seconds to execute and required at least min_examined_row_limit rows to be examined. The time to acquire the initial table locks is not counted as execution time. mysqld writes a statement to the slow query log after it has been executed and [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://lifelinux.com/mysql-slow-query-log-file/">MySQL Slow Query Log File</a> appeared first on <a rel="nofollow" href="https://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><blockquote><p>The slow query log consists of all SQL statements that took more than long_query_time seconds to execute and required at least min_examined_row_limit rows to be examined. The time to acquire the initial table locks is not counted as execution time. <strong>mysqld</strong> writes a statement to the slow query log after it has been executed and after all locks have been released, so log order might be different from execution order. The default value of <strong>long_query_time</strong> is 10. The minimum value is 0, and a resolution of microseconds is supported when logging to a file. However, the microseconds part is ignored and only integer values are written when logging to tables.<br />
Source: http://dev.mysql.com/doc/refman/5.5/en/slow-query-log.html
</p></blockquote>
<p><span id="more-349"></span></p>
<p>To make the change permanent whenever the MySQL server is started, and for MySQL prior 5.1.x, edit your my.cnf file (on Linux boxes this is usually somewhere like /etc/my.cnf or /etc/mysql/my.cnf) and uncomment the &#8220;log_slow_queries&#8221; line or add it if it&#8217;s not present.<br />
On a CentOS, type the following command</p>
<pre>
[root@server2 ~]# vi /etc/my.cnf
</pre>
<p>For example, the line to uncomment looks like so:</p>
<pre>
...
log_slow_queries = /var/log/mysql/mysql-slow-queries.log
...
</pre>
<p>You can change the log file name to something else or leave it blank so it uses the default. The default is to log the queries into a file in the MySQL data directory.</p>
<h3>Setting the long_query_time</h3>
<p>You can also specify how long a quey needs to run for before it is logged with the &#8220;long_query_time&#8221; setting. By default this is 10 seconds. In the my.cnf file, to change it to e.g. 1 second add the following:</p>
<pre>
...
long_query_time = 1
log_slow_queries = /var/log/mysql/mysql-slow-queries.log
...
</pre>
<p>After that, restart mysql service. Enter the following command:</p>
<pre>
[root@server2 ~]# /etc/init.d/mysqld restart
</pre>
<g:plusone href="https://lifelinux.com/mysql-slow-query-log-file/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="https://lifelinux.com/mysql-slow-query-log-file/">MySQL Slow Query Log File</a> appeared first on <a rel="nofollow" href="https://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://lifelinux.com/mysql-slow-query-log-file/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
