<?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"
	>
<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>
	<pubDate>Mon, 01 Dec 2008 20:11:04 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<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'll send you an e-mail directly about your concerns as soon as I can.</description>
		<content:encoded><![CDATA[<p>@matt - I&#8217;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'm hoping you can help me out here.

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).

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&#8217;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&#8217;ve ever come across it in a year.  It is strange though because I would have expected it a year ago.  I&#8217;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&#8217;m about 95% sure that our traffic didn&#8217;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 'admin' 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 &#8216;admin&#8217; 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;"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."&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's going on. See &lt;a href="http://dev.mysql.com/doc/refman/5.0/en/too-many-connections.html" rel="nofollow"&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>&#8220;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.&#8221;</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&#8217;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>
