rondog Posted September 24, 2008 Share Posted September 24, 2008 So my site has been working fine until today...I am getting this error when I try to browse to it: Warning: mysql_connect() [function.mysql-connect]: Too many connections in.......blah blach etc etc I am on a 1and1 shared host account if that makes a difference. I have another site on the same server, although using a different database and it works fine still. I tried opening phpMyAdmin through my 1and1 control panel and the control panel is even throwing an error: phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in config.inc.php and make sure that they correspond to the information given by the administrator of the MySQL server. Error MySQL said: Documentation #1040 - Too many connections Quote Link to comment https://forums.phpfreaks.com/topic/125703-too-many-connections/ Share on other sites More sharing options...
corbin Posted September 25, 2008 Share Posted September 25, 2008 Try setting your maximum connections setting higher (if it will let you). Also, be careful with persistent connections as they can do wacky things. How exactly is your DB stuff being handled? Quote Link to comment https://forums.phpfreaks.com/topic/125703-too-many-connections/#findComment-650107 Share on other sites More sharing options...
rondog Posted September 25, 2008 Author Share Posted September 25, 2008 What do you mean by persistent connections? Quote Link to comment https://forums.phpfreaks.com/topic/125703-too-many-connections/#findComment-650504 Share on other sites More sharing options...
mysqldba Posted September 26, 2008 Share Posted September 26, 2008 Most languages have the option to use 'persistent' connections - this is where a connection to a MySQL server is kept open, even after the script has finished executing. This can be useful to (usually marginally) speed up a script, as the next time the script is executed the MySQL server connection attempt is quickly handed the existing connection. The down side to this is that by holding the connection open, it uses up one of the available connection slots on the MySQL server and so could potentially block another connection attempt (the MySQL server does not have a LRU disconnection policy). As for your "Too many connections" problem, it could be one of three things: 1) The server has too many open connections already. A MySQL server can only handle a specific number of open connections before refusing to allow any more, and this limit is shared amongst all users of the server. It's usually set quite high, although it's easily possible for someone to effectively DoS a MySQL server by making lots of connections (but see below) 2) Your user account has a limited number of connections allowed per hour - any further connections within that hour would be rejected. This is set on a per-user basis. 3) Your user accounts has a limited number of allowable open connections - any further connections would be rejected. This is set on a per-user basis. It's always important to read the error message you get returned on the connection attempt, as in most cases this will pinpoint the exact reason for failure. If your account has a maximum number of connections limit (scenario #3), the error would be: ERROR 1226 (42000): User 'mysqldba' has exceeded the 'max_user_connections' resource (current value: 1) Where 'mysqldba' would be your username, and the 'current value' is the maximum number of open connections allowed from this user. If you account has a maximum number of connections per hour limit (scenario #2), the error would be: ERROR 1226 (42000): User 'mysqldba' has exceeded the 'max_connections_per_hour' resource (current value: 1) Where, once again, 'mysqldba' would be your username, and the 'current value' is the maximum number of connections per hour allowed for this user. The error message you got (code 1040) indicates that the entire MySQL server has run out of connection slots - this is the DoS scenario I mention above. What can you do about it? From what you've said, you don't have superuser privileges on this server, so nothing, apart from complain to the SysAdmin responsible for that server. They might increase the maximum number of connections allowed, which could solve the problem short-term, but if someone else using the server is creating a stupid number of database connections the slots would just fill up again. What they probably should do is to also enforce a per-user maximum open connection limit as well - this would stop the heavy users clogging up the server. In a shared-server situation like yours, this would make the most sense - 'power users' would/should have their own server, or could/should pay to increase their maximum open connections. Quote Link to comment https://forums.phpfreaks.com/topic/125703-too-many-connections/#findComment-651134 Share on other sites More sharing options...
eddie21leeds Posted August 10, 2010 Share Posted August 10, 2010 Thanks for the info, same here. im on a 1and1 'Unlimited' account. :| Quote Link to comment https://forums.phpfreaks.com/topic/125703-too-many-connections/#findComment-1097408 Share on other sites More sharing options...
eddie21leeds Posted August 10, 2010 Share Posted August 10, 2010 Same here, I'm on a 1and1 'unlimited' account. Thanks for the info, save me 10p a minute for customer suppourt. I think i will just ride it out and browse for funny pictures of animals or something while it sorts itself! Quote Link to comment https://forums.phpfreaks.com/topic/125703-too-many-connections/#findComment-1097410 Share on other sites More sharing options...
user999 Posted September 16, 2013 Share Posted September 16, 2013 I am having this issue on and off for about a year now .. it seems that they would like me to purchase "dedicated server" hosting, because they only solve this problem for a period of time. My forum is nowhere near that busy or producing that kind of money. In retrospect, I am regretting for purchasing 1&1 hosting. After 7 yaers of being their customer one would think they would appreciate it, but they just don't care. Quote Link to comment https://forums.phpfreaks.com/topic/125703-too-many-connections/#findComment-1449702 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.