<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: MySQL: ERROR 1040: Too many connections</title>
	<atom:link href="http://rackerhacker.com/2008/06/24/mysql-error-1040-too-many-connections/feed/" rel="self" type="application/rss+xml" />
	<link>http://rackerhacker.com/2008/06/24/mysql-error-1040-too-many-connections/</link>
	<description>Words of wisdom from a server administrator</description>
	<lastBuildDate>Sat, 11 Feb 2012 23:43:21 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: dinh vi</title>
		<link>http://rackerhacker.com/2008/06/24/mysql-error-1040-too-many-connections/#comment-25891</link>
		<dc:creator>dinh vi</dc:creator>
		<pubDate>Fri, 02 Dec 2011 14:15:36 +0000</pubDate>
		<guid isPermaLink="false">http://rackerhacker.com/?p=315#comment-25891</guid>
		<description>Hi Major,
My VPS always slow down, I&#039;ve use mysqltuner to check mysql config already, followed its recommends as well but it still isn&#039;t worked well. Can you show me another techniques?
Here is my VPS info:
RAM: 1GB
CPU: 1GHz
Thanks in advance.</description>
		<content:encoded><![CDATA[<p>Hi Major,<br />
My VPS always slow down, I've use mysqltuner to check mysql config already, followed its recommends as well but it still isn't worked well. Can you show me another techniques?<br />
Here is my VPS info:<br />
RAM: 1GB<br />
CPU: 1GHz<br />
Thanks in advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Zulian</title>
		<link>http://rackerhacker.com/2008/06/24/mysql-error-1040-too-many-connections/#comment-23114</link>
		<dc:creator>Zulian</dc:creator>
		<pubDate>Fri, 03 Jun 2011 13:47:50 +0000</pubDate>
		<guid isPermaLink="false">http://rackerhacker.com/?p=315#comment-23114</guid>
		<description>Hi Major, I have this connection problem. I have php application on 10 server and 1 mysql server. All 10 php connect to the mysql server (master). And I got the Gateway Timeout (after firefox spinning about 1 minute) on the browser when the client reaches for about 1000. Thread connected is above 1000.

But when I place the php application and the mysql server together on 1 server (connect to localhost) I never got the problem. Even its just 1 server running with the same amount of client (1000 connected client). Thread connected is 2 or 3.

How this could happen? 
Connect to other server : Thread connected is above 1000.
Connect to localhost : Thread connected is 2 or 3.</description>
		<content:encoded><![CDATA[<p>Hi Major, I have this connection problem. I have php application on 10 server and 1 mysql server. All 10 php connect to the mysql server (master). And I got the Gateway Timeout (after firefox spinning about 1 minute) on the browser when the client reaches for about 1000. Thread connected is above 1000.</p>
<p>But when I place the php application and the mysql server together on 1 server (connect to localhost) I never got the problem. Even its just 1 server running with the same amount of client (1000 connected client). Thread connected is 2 or 3.</p>
<p>How this could happen?<br />
Connect to other server : Thread connected is above 1000.<br />
Connect to localhost : Thread connected is 2 or 3.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Database profeesionals. What does this MySQL error mean</title>
		<link>http://rackerhacker.com/2008/06/24/mysql-error-1040-too-many-connections/#comment-16593</link>
		<dc:creator>Database profeesionals. What does this MySQL error mean</dc:creator>
		<pubDate>Mon, 20 Sep 2010 21:26:27 +0000</pubDate>
		<guid isPermaLink="false">http://rackerhacker.com/?p=315#comment-16593</guid>
		<description>[...] swap memory and it will become highly unstable (or crash). Consult with a sysadmin/DBA and review:  MySQL: ERROR 1040: Too many connections &#124; Racker Hacker  rjamestaylor 27.01.10 at 11:37 This is not going to end well. @jamtech338 - please take [...]</description>
		<content:encoded><![CDATA[<p>[...] swap memory and it will become highly unstable (or crash). Consult with a sysadmin/DBA and review:  MySQL: ERROR 1040: Too many connections | Racker Hacker  rjamestaylor 27.01.10 at 11:37 This is not going to end well. @jamtech338 - please take [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chuck</title>
		<link>http://rackerhacker.com/2008/06/24/mysql-error-1040-too-many-connections/#comment-15511</link>
		<dc:creator>Chuck</dc:creator>
		<pubDate>Sat, 26 Sep 2009 05:05:33 +0000</pubDate>
		<guid isPermaLink="false">http://rackerhacker.com/?p=315#comment-15511</guid>
		<description>If everything is configured correctly and you still get this error, it means one of two things:  Your server got really busy or you got cracked.</description>
		<content:encoded><![CDATA[<p>If everything is configured correctly and you still get this error, it means one of two things:  Your server got really busy or you got cracked.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Increase MySQL connection limit &#124; Racker Hacker</title>
		<link>http://rackerhacker.com/2008/06/24/mysql-error-1040-too-many-connections/#comment-14030</link>
		<dc:creator>Increase MySQL connection limit &#124; Racker Hacker</dc:creator>
		<pubDate>Thu, 23 Apr 2009 01:47:24 +0000</pubDate>
		<guid isPermaLink="false">http://rackerhacker.com/?p=315#comment-14030</guid>
		<description>[...] increasing MySQL&#8217;s connection limit, you really owe it to yourself (and your server), to find out why you&#8217;re reaching the maximum number of connections. Over 90% of the MySQL servers that are hitting the maximum connection limit have a performance [...]</description>
		<content:encoded><![CDATA[<p>[...] increasing MySQL&#8217;s connection limit, you really owe it to yourself (and your server), to find out why you&#8217;re reaching the maximum number of connections. Over 90% of the MySQL servers that are hitting the maximum connection limit have a performance [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam</title>
		<link>http://rackerhacker.com/2008/06/24/mysql-error-1040-too-many-connections/#comment-13970</link>
		<dc:creator>Sam</dc:creator>
		<pubDate>Thu, 19 Mar 2009 21:08:31 +0000</pubDate>
		<guid isPermaLink="false">http://rackerhacker.com/?p=315#comment-13970</guid>
		<description>In theory, having n+1 max_connections is a good idea for the root user.

That is, of course, assuming that MySQL hasn&#039;t started swapping to disk to satisfy the configuration (i.e. opening as many threads/connections as the config allows). This is where things become wonky -- high load and iowait, etc. You will be waiting a long time to SSH in and wrangle the box back to normalcy, or connect via MySQL remotely if you have that configured.

@thornibr was dead on with this:
&quot;You should set global max_connections to a value that allows your sever to handle the connections - not increase global max_connections when your server cannot handle the current amount of connections.&quot;  &lt;--- exactly.

It should be noted that MySQLTuner is very helpful in preventing these problems with its memory usage calculations vs installed RAM.

Good post, Major. =]</description>
		<content:encoded><![CDATA[<p>In theory, having n+1 max_connections is a good idea for the root user.</p>
<p>That is, of course, assuming that MySQL hasn't started swapping to disk to satisfy the configuration (i.e. opening as many threads/connections as the config allows). This is where things become wonky -- high load and iowait, etc. You will be waiting a long time to SSH in and wrangle the box back to normalcy, or connect via MySQL remotely if you have that configured.</p>
<p>@thornibr was dead on with this:<br />
"You should set global max_connections to a value that allows your sever to handle the connections - not increase global max_connections when your server cannot handle the current amount of connections."  &lt;--- exactly.</p>
<p>It should be noted that MySQLTuner is very helpful in preventing these problems with its memory usage calculations vs installed RAM.</p>
<p>Good post, Major. =]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: major</title>
		<link>http://rackerhacker.com/2008/06/24/mysql-error-1040-too-many-connections/#comment-2601</link>
		<dc:creator>major</dc:creator>
		<pubDate>Wed, 03 Sep 2008 22:01:09 +0000</pubDate>
		<guid isPermaLink="false">http://rackerhacker.com/?p=315#comment-2601</guid>
		<description>@matt - I&#039;ll send you an e-mail directly about your concerns as soon as I can.</description>
		<content:encoded><![CDATA[<p>@matt - I'll send you an e-mail directly about your concerns as soon as I can.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: matt</title>
		<link>http://rackerhacker.com/2008/06/24/mysql-error-1040-too-many-connections/#comment-2600</link>
		<dc:creator>matt</dc:creator>
		<pubDate>Wed, 03 Sep 2008 21:50:10 +0000</pubDate>
		<guid isPermaLink="false">http://rackerhacker.com/?p=315#comment-2600</guid>
		<description>Major, I&#039;m hoping you can help me out here.

Today the database I mange gave me the 1040 error which was the first time I&#039;ve ever come across it in a year.  It is strange though because I would have expected it a year ago.  I&#039;ve moved the DB onto a PowerEdge 1950 and have done a fair amount of query optimization during the year so that our site is very responsive.  Also, I&#039;m about 95% sure that our traffic didn&#039;t skyrocket (will have to check analytics tomorrow).

I guess my question is, how can the things you mention above affect the max_connections issue?  Is it that the suggestions you make are intended to connect/disconnect as quickly as possible in order to avoid the max_connections limit? (That seems to be the only logical thing in my mind.)

Also, what are your thoughts on setting the max_connections, of a dedicated mysql, server to 0?</description>
		<content:encoded><![CDATA[<p>Major, I'm hoping you can help me out here.</p>
<p>Today the database I mange gave me the 1040 error which was the first time I've ever come across it in a year.  It is strange though because I would have expected it a year ago.  I've moved the DB onto a PowerEdge 1950 and have done a fair amount of query optimization during the year so that our site is very responsive.  Also, I'm about 95% sure that our traffic didn't skyrocket (will have to check analytics tomorrow).</p>
<p>I guess my question is, how can the things you mention above affect the max_connections issue?  Is it that the suggestions you make are intended to connect/disconnect as quickly as possible in order to avoid the max_connections limit? (That seems to be the only logical thing in my mind.)</p>
<p>Also, what are your thoughts on setting the max_connections, of a dedicated mysql, server to 0?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Probable DDOS attack Using SQL Injection on my Websites &#124; Strangely Perfect</title>
		<link>http://rackerhacker.com/2008/06/24/mysql-error-1040-too-many-connections/#comment-2576</link>
		<dc:creator>Probable DDOS attack Using SQL Injection on my Websites &#124; Strangely Perfect</dc:creator>
		<pubDate>Fri, 22 Aug 2008 11:57:29 +0000</pubDate>
		<guid isPermaLink="false">http://rackerhacker.com/?p=315#comment-2576</guid>
		<description>[...] was one result, http://rackerhacker.com/2008/06/24/mysql-error-1040-too-many-connections/ from the web, and another from the horse&#8217;s mouth [...]</description>
		<content:encoded><![CDATA[<p>[...] was one result, <a href="http://rackerhacker.com/2008/06/24/mysql-error-1040-too-many-connections/" rel="nofollow">http://rackerhacker.com/2008/06/24/mysql-error-1040-too-many-connections/</a> from the web, and another from the horse&#8217;s mouth [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: thornibr</title>
		<link>http://rackerhacker.com/2008/06/24/mysql-error-1040-too-many-connections/#comment-1864</link>
		<dc:creator>thornibr</dc:creator>
		<pubDate>Sat, 28 Jun 2008 19:05:36 +0000</pubDate>
		<guid isPermaLink="false">http://rackerhacker.com/?p=315#comment-1864</guid>
		<description>@breun
Yes - you are totally correct. However this issue comes about if you have a user that has a grant like:

GRANT ALL ON *.* to XXX..

And you are silly enough to use that user within your application. 

If you create a user for a database and as a result have security in mind, you can still get in with your &#039;admin&#039; account as you point out.

But as major points out, if you are seeing max_connnections errors,  chances are your schema, buffers or queries are at fault. 


What everyone should really do is create user accounts and set max_connections for that specific user to a value, say 10. And then set global max_connections to be upto the sum of every users max_connections.

Setting max_connections on a per user basis will prevent (or at very least reduce) a single site/database on a shared hosting system from hogging all of the database resources.

You should set global  max_connections to a value that allows your sever to handle the connections - not increase global max_connections when your server cannot handle the current amount of connections.</description>
		<content:encoded><![CDATA[<p>@breun<br />
Yes - you are totally correct. However this issue comes about if you have a user that has a grant like:</p>
<p>GRANT ALL ON *.* to XXX..</p>
<p>And you are silly enough to use that user within your application. </p>
<p>If you create a user for a database and as a result have security in mind, you can still get in with your 'admin' account as you point out.</p>
<p>But as major points out, if you are seeing max_connnections errors,  chances are your schema, buffers or queries are at fault. </p>
<p>What everyone should really do is create user accounts and set max_connections for that specific user to a value, say 10. And then set global max_connections to be upto the sum of every users max_connections.</p>
<p>Setting max_connections on a per user basis will prevent (or at very least reduce) a single site/database on a shared hosting system from hogging all of the database resources.</p>
<p>You should set global  max_connections to a value that allows your sever to handle the connections - not increase global max_connections when your server cannot handle the current amount of connections.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: breun</title>
		<link>http://rackerhacker.com/2008/06/24/mysql-error-1040-too-many-connections/#comment-1774</link>
		<dc:creator>breun</dc:creator>
		<pubDate>Tue, 24 Jun 2008 18:04:09 +0000</pubDate>
		<guid isPermaLink="false">http://rackerhacker.com/?p=315#comment-1774</guid>
		<description>&lt;blockquote&gt;&quot;You won’t even be able to connect to MySQL to find out what is causing the connections to be used up, so you will be forced to restart the MySQL daemon to troubleshoot the issue.&quot;&lt;/blockquote&gt;

According to the documentation MySQL always reserves one extra connection so a user with the SUPER privilege can login and see what&#039;s going on. See &lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/too-many-connections.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;:

&lt;blockquote&gt;mysqld actually allows max_connections+1 clients to connect. The extra connection is reserved for use by accounts that have the SUPER privilege. By granting the SUPER privilege to administrators and not to normal users (who should not need it), an administrator can connect to the server and use SHOW PROCESSLIST to diagnose problems even if the maximum number of unprivileged clients are connected. See Section 12.5.4.21, “SHOW PROCESSLIST Syntax”.&lt;/blockquote&gt;</description>
		<content:encoded><![CDATA[<blockquote><p>"You won’t even be able to connect to MySQL to find out what is causing the connections to be used up, so you will be forced to restart the MySQL daemon to troubleshoot the issue."</p></blockquote>
<p>According to the documentation MySQL always reserves one extra connection so a user with the SUPER privilege can login and see what's going on. See <a href="http://dev.mysql.com/doc/refman/5.0/en/too-many-connections.html" rel="nofollow">here</a>:</p>
<blockquote><p>mysqld actually allows max_connections+1 clients to connect. The extra connection is reserved for use by accounts that have the SUPER privilege. By granting the SUPER privilege to administrators and not to normal users (who should not need it), an administrator can connect to the server and use SHOW PROCESSLIST to diagnose problems even if the maximum number of unprivileged clients are connected. See Section 12.5.4.21, “SHOW PROCESSLIST Syntax”.</p></blockquote>
]]></content:encoded>
	</item>
</channel>
</rss>

