Jump to content
xisto Community
Chesso

Mysql Error Never Seen On My Site Before (too Many Connections).

Recommended Posts

I just tried to visit my site to see if anything had changed on my forums and such and I got this message:Warning: mysql_connect(): Too many connections in /xxxx/xxxxx/xxxxxx_xxxxx/xxx/xx_xxxx.php on line 7Error! Could not connect: Too many connections.I have never recieved this error before, does this mean someone is mucking with my site somehow???The particular php file it mentions is the one that defines variables like db username etc and connection to the site's database that I include wherever it is needed in various file for the site.EDIT:I managed to get in and went to another page and again recieved another error message:Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /xxxx/xxxxx/xxxxxx_xxxx/xxx/xx_xxxxx.php on line 7Error! Could not connect: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

Edited by Chesso (see edit history)

Share this post


Link to post
Share on other sites

It seems that MySQL was down at the time you posted that message. That's why your forum couldn't connect. I'm quite sure that it is working now. As for the first problem, I can only take a wild guess that too many people were trying to access your site and therefore the database, too. I believe that this can be a consequence of a DoS (denial of service) attack, when your site is "bombed" with numerous requests and connections.

Share this post


Link to post
Share on other sites

I had this problem like a thousand times on my website before. I mean, I thought it would be some sort of an uptime/downtime problem but I have no idea what the heck is going on!!Please pardon me if I'm being very explosive but when it last happened and I posted a problematic thread/post on the hosted members' support page, I don't believe I got any help on it.I saw other people's posts about the same thing / incident but I don't believe they got any help either.What's going on?

Share this post


Link to post
Share on other sites

Ahh if it's a problem with Xisto then I am relieved lol, I moderate over at slavehack.com (browser/text based hacking game) and some know of my site, I was hoping someone didn't get pissy and bugger around with my site.*phew, whipes forhead*

Share this post


Link to post
Share on other sites

most of the time. it merely means that the database server have reached its maximum connection setting..on my personal machines, i have set the max connection to a very large numbers and that is not a big problem though since i have a bigger memory and cpu power.. besides my webserver, nothing is running on it..--in environments like asta, we cannot change the max connection of the database server since it will affect all users and may bog down the whole system in total..--the was one error more if the problem is database incapability to handle new connection, it will yank a port or socket connection error.. i believe that is apache or PHP engine that is yanking that error..

Share this post


Link to post
Share on other sites

I saw this error too, more than 12 hours ago, but the error message "to many connections" says it all, of course it is bad for most of us, because a lot of whose content is in the database (I guess) so it is sort of downtown, I also couldn't access CPanel Mysql Databases and PHPMyAdmin, I understand why, now it seems that CPanel MySQL Databases and PHPMyAdmin works, but quite slow, but maybe this is just me. :unsure:

Share this post


Link to post
Share on other sites

Seems fine now. I had a couple of slips but other then that it's just fine.P.S. Does anyone have any clue how you can have increased AdSense ad sizes? I use 728x90 but I need it atleast with 738 width... :unsure:

Edited by Chesso (see edit history)

Share this post


Link to post
Share on other sites

Anyways, back on topic of MySQL connections...That message is just a sort of "protection" for MySQL. if it allowed many connections, the MySQL server could crash due to a high amount of connections. It is sorta the server's "safety backup" kicking in. I guess a lot of people are using MySQL then.This should be nothing to worry about.[N]F

Share this post


Link to post
Share on other sites

Nope, you can use only those that are predefined in the AdSense control panel.


As a matter of fact I saw Google ads which looked a bit customized, I don't know how they did it, but I think they just added javascript, but maybe this is special ads of somekind, they really pointed to google adsense links, can't remember the site, so maybe it is possible, you always can email google adsense team, but I don't know what they could answer, it is better to ask if it is possible and not if I can, I think :unsure:

Share this post


Link to post
Share on other sites

I had this problem like a thousand times on my website before. I mean, I thought it would be some sort of an uptime/downtime problem but I have no idea what the heck is going on!!
Please pardon me if I'm being very explosive but when it last happened and I posted a problematic thread/post on the hosted members' support page, I don't believe I got any help on it.

I saw other people's posts about the same thing / incident but I don't believe they got any help either.

What's going on?

The reason you received no help on the matter is because by the time someone noticed the post, the problem was gone. SO in order to reply to your particular post, "Please wait and do not refresh your website over and over and see how things are in about an hour if the problem hasn't already be resolved."

We all share the same MySQL server. The too many connections refers to everyones connections usually. While there is a cap on the number of connections each website may have at once, the entire server also has a cap which is not as large as all of the individual accounts put together so if 10% or more of the websites are at or near their maximum, then the server could be overwhelmed. I'm not sure what the exact figures are for these settings but this is usually what happens. This usually clears up in a few minutes unless we get a few impatient people trying to get the pages to load. Now not only did you have too many connections on the server to begin with, everybody is trying to refresh the error page to get the webpage to load correctly. Few people realize that by repeatedly trying to get the page to load they are actually making the problem worse. Most database connections last less than a secondso in order to have too many connections, there has to be a lot of connection requests all at the same second for the most part.

Probably the biggest cause of this error to begin with is poor script optimization. Basicaly Joe Blow writes a script that accesses the database in a sloopy way. As a result, his sloopy code on his rather poorly designed website can have the same impact on the server as Bill's really busy and well designed website. So Joe's site kills the server then Bill's users keep the server over taxed with their page refreshes and reloads.

OpaQue tries to identify websites on the server that have this kind of negative impact on the rest of the accounts and either work with the account holder to correct the problem or if need be remove the problem file.

So my suggestion to you is to create a backup page for your website that you can use to relieve the server burden. Some kind of "Technical Difficulties" message that you can set all of your webpages to redirect to via your .htaccess file. Then when this proble comes up, just switch over to your message page and that will prevent your users from continuing the connection flood on the database server.

Better yet, rewrite your scripts to respond better to the Too Many Connections Error. If this happens instead of telling the user right away, make the script sleep for a few seconds so they don't refresh right away. A five second pause for everyone on your site could be just what the server needs to get caught up. Using a random number between 5 and 10 seconds would also keep everyone from your website from having the opportunity to refresh at the same time.

One additional suggestion, let your user know what the problem and the solution is. If you tell your user that the problem is caused by too many connections at the same time and inform them that refreshing the page will only make the problem worse, they will be less likely to add to the problem. Kindly ask them to wait a minute before they try to refresh and most will at leat give it 10 seconds. :D Usually, the serve doesn't need a big break, just enough to get caught up and it will be fine.

For best results, you should use all of these techniques together. If everyone used just one of these suggestions, then the server would never be down. This is particularly true for a server pause when this error occurs since the server just needs a second or two without a connection request.

Hope this helps. :unsure:

vujsa

Share this post


Link to post
Share on other sites

Was probably too many global wide connections. The home page only makes like 2 mysql_query's that are relativly simple select statements for one field of a row.

Share this post


Link to post
Share on other sites

i think the choking points of the database server is starting to become frequent..i dont know what is going on but judging on the number of shared hostings here..3 malfuntioning scripts specially if they are on cron can crashed the server almost instantly...the negative impacts of shared hosting..

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.