Comments on: Too many connections? No problem! https://www.percona.com/blog/too-many-connections-no-problem/ Fri, 06 Jan 2017 18:12:33 +0000 hourly 1 https://wordpress.org/?v=6.5.2 By: Thanks mate! https://www.percona.com/blog/too-many-connections-no-problem/#comment-10967538 Fri, 06 Jan 2017 18:12:33 +0000 https://www.percona.com/blog/?p=2322#comment-10967538 Best trick ever

]]>
By: Aurimas https://www.percona.com/blog/too-many-connections-no-problem/#comment-10966402 Thu, 21 Apr 2016 11:51:44 +0000 https://www.percona.com/blog/?p=2322#comment-10966402 @Yakubpasha – this only works if you didn’t make a mistake of giving SUPER privileges to your application user. Because if you did – even the connection reserved for root user will be used. That’s where the gdb trick becomes useful.

]]>
By: Yakubpasha https://www.percona.com/blog/too-many-connections-no-problem/#comment-10966401 Thu, 21 Apr 2016 09:59:46 +0000 https://www.percona.com/blog/?p=2322#comment-10966401 Fix:
1.Connect to DB(Open command prompt->mysql –u=root –p= Press enter
2.run the following command once you connected to mysql
->SET GLOBAL max_connections = 10000;

]]>
By: Ashbeel https://www.percona.com/blog/too-many-connections-no-problem/#comment-10965541 Fri, 13 Nov 2015 18:54:24 +0000 https://www.percona.com/blog/?p=2322#comment-10965541 MySQL connect ERROR: Too many connections

]]>
By: JoseM https://www.percona.com/blog/too-many-connections-no-problem/#comment-899258 Thu, 15 Mar 2012 17:47:04 +0000 https://www.percona.com/blog/?p=2322#comment-899258 Hello everyone;

I have my website develop in PHP with MYSQL, these are MYSQL values:

datadir=/data/mysql
socket=/data/mysql/mysql.sock
max_connections = 600
wait_timeout = 60
interactive_timeout=1800
skip-name-resolve
skip-bdb
default-time-zone=America/Caracas
log-slow-queries=/var/log/mysql-slow-queries.log
long_query_time=15
log-queries-not-using-indexes
query_cache_type=1
query_cache_size=32M
thread_cache_size=30
table_cache=4096
join_buffer_size=6M
key_buffer_size=12M
server-id = 1
log-bin=/data/mysql/drbd
expire_logs_days = 5
max_binlog_size = 100M
[client]
socket=/data/mysql/mysql.sock

When I start the database service that starts smoothly with a low number of connections and so remains for a few minutes, but then so sopresiva connections to the database increases reaching the maximum of connections and I have to re-restart the server.
I’ve checked the security aspect and not an attack, will have any suggestions or ideas of what might be causing thereby increase the number of connections?
Thanks a lot

]]>
By: Aurimas Mikalauskas https://www.percona.com/blog/too-many-connections-no-problem/#comment-846591 Fri, 25 Nov 2011 14:46:04 +0000 https://www.percona.com/blog/?p=2322#comment-846591 I can’t think of anything right now- I’d have to search for them and read to verify they are relevant. I can’t write one either right now 🙂 But I found one article here written by Peter long time ago, which is actually very much related to it:

http://www.mysqlperformanceblog.com/2007/02/05/why-do-you-need-many-apache-children/

]]>
By: Andrews https://www.percona.com/blog/too-many-connections-no-problem/#comment-845985 Thu, 24 Nov 2011 11:57:39 +0000 https://www.percona.com/blog/?p=2322#comment-845985 Aurimas, thanks a lot for your reply.

Could you refer to me some article to check it out about this topic, the idea is make a balance between apache conections and MySQL max_conections.

Thanks in advance.

]]>
By: Aurimas Mikalauskas https://www.percona.com/blog/too-many-connections-no-problem/#comment-845890 Thu, 24 Nov 2011 08:11:28 +0000 https://www.percona.com/blog/?p=2322#comment-845890 Romeo, could it be the symbols (debug package) is not available for the version of MySQL you are using? Also, this may be gdb dependent, but are you sure you should be using -pid instead of –pid or -p ?

Andrews – this article is only about changing max_connections when MySQL server is using all of the available slots and you need to log into it to fix it (say kill some mysql queries) without restarting mysql server. Apache httpd settings is entirely different (and actually more important) topic, but there’s no simple answer here i.e. it depends on why you are hitting the max connections limit in the first place.

Aurimas

]]>
By: Andrews https://www.percona.com/blog/too-many-connections-no-problem/#comment-845659 Wed, 23 Nov 2011 22:13:33 +0000 https://www.percona.com/blog/?p=2322#comment-845659 Hello, every one.

Aurimas excellent article,

I have read almost all the comments because a few days ago we had the same problem with our new web site, but I have a question about this change and I will share with you to see if you can answer it.

When doing this kind of change? No need to change some other side of apache? Considering that increasing the number of connections is possible that the workload increase on the web server or not?

]]>
By: Romeo https://www.percona.com/blog/too-many-connections-no-problem/#comment-844468 Mon, 21 Nov 2011 14:43:36 +0000 https://www.percona.com/blog/?p=2322#comment-844468 I have tried that but it is giving this error:
> gdb -pid 17391 -ex “set max_connections=5000” -batch
set max_connections=5000: No such file or directory.
(no debugging symbols found)
Using host libthread_db library “/lib/tls/libthread_db.so.1”.
0x082e674f in ?? ()

]]>
By: Aurimas Mikalauskas https://www.percona.com/blog/too-many-connections-no-problem/#comment-844376 Mon, 21 Nov 2011 11:09:16 +0000 https://www.percona.com/blog/?p=2322#comment-844376 Romeo, this seems to be run incorrectly. You should not use PID as a variable i.e. $17391, instead try:

gdb -p 17391 -ex “set max_connections=5000″ -batch

Aurimas

]]>
By: Romeo https://www.percona.com/blog/too-many-connections-no-problem/#comment-844313 Mon, 21 Nov 2011 07:52:47 +0000 https://www.percona.com/blog/?p=2322#comment-844313 I have tried this command in our redhat server w/ mysql having “too many connection” problem & it doesn’t work.

gdb -p $(cat data/mysql_sandbox5087.pid) -ex “set max_connections=5000” -batch

> gdb -p $17391 -ex “set max_connections=5000” -batch
GNU gdb Red Hat Linux (6.3.0.0-1.162.el4rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type “show copying” to see the conditions.
There is absolutely no warranty for GDB. Type “show warranty” for details.
This GDB was configured as “i386-redhat-linux-gnu”…set max_connections=5000: No such file or directory.

/mysql/data/-batch: No such file or directory.
(gdb)

I have tried “–batch” and putting a complete command syntax for all still returns the above error.

We can’t restart the DB or the server. What should I do next?

]]>
By: caraga https://www.percona.com/blog/too-many-connections-no-problem/#comment-772300 Mon, 23 Aug 2010 05:44:31 +0000 https://www.percona.com/blog/?p=2322#comment-772300 i was impress this thing additional to this i work an application that uses vb.net and i use a control backgroundworker as my asyncronous mysql connection to database to retrieve data every second after a long running application suddenly ived enctour a too many connection in my mysql server 5+.

]]>
By: Aurimas Mikalauskas https://www.percona.com/blog/too-many-connections-no-problem/#comment-742476 Fri, 02 Apr 2010 10:40:32 +0000 https://www.percona.com/blog/?p=2322#comment-742476 Domas, if you could pull a trick showing us how to reset wait_timeout for all running threads from your hat, that would be something new!

]]>
By: Aurimas Mikalauskas https://www.percona.com/blog/too-many-connections-no-problem/#comment-742474 Fri, 02 Apr 2010 10:38:05 +0000 https://www.percona.com/blog/?p=2322#comment-742474 Xupeng, now go fix the configuration of your server so you never run into this again 😉 See comments above for tips on how to do that

]]>
By: Xupeng https://www.percona.com/blog/too-many-connections-no-problem/#comment-741879 Wed, 31 Mar 2010 12:42:43 +0000 https://www.percona.com/blog/?p=2322#comment-741879 I just rescued my dying MySQL server with the help of this useful tip, thank you 🙂

]]>
By: domas https://www.percona.com/blog/too-many-connections-no-problem/#comment-740613 Sat, 27 Mar 2010 15:43:58 +0000 https://www.percona.com/blog/?p=2322#comment-740613 damn, all the dirty tricks get revealed, got to get a new bag now…

]]>
By: Peter Zaitsev https://www.percona.com/blog/too-many-connections-no-problem/#comment-740205 Fri, 26 Mar 2010 15:53:44 +0000 https://www.percona.com/blog/?p=2322#comment-740205 Aurimas,

What I’d do is to change connections to higher value so you can connect and when change it again using MySQL way so it is resized as needed.
I would be careful calling functions in GDB unless you’re sure it is safe – mutexes etc may cause unwanted side effects.

]]>
By: Baron Schwartz https://www.percona.com/blog/too-many-connections-no-problem/#comment-739937 Thu, 25 Mar 2010 21:00:40 +0000 https://www.percona.com/blog/?p=2322#comment-739937 Yeah, but if possible I’d be more comfortable letting things happen through the database’s own code path. Maybe paranoid, but …

]]>
By: Aurimas Mikalauskas https://www.percona.com/blog/too-many-connections-no-problem/#comment-739888 Thu, 25 Mar 2010 16:35:40 +0000 https://www.percona.com/blog/?p=2322#comment-739888 Or just run:


gdb -p $(pidof mysqld) \
-ex "set max_connections=5000" \
-ex "call resize_thr_alarm(5030)" -batch

?

]]>