MySQL Too many connections

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Pmaurer
Forum Newbie
Posts: 5
Joined: Sat Sep 20, 2008 10:59 pm

MySQL Too many connections

Post by Pmaurer »

I searched the tutorials forum and couldn't find a solution to this problem...sorry if it is somewhere and I missed it.
My website goes down at least 3-4 times a week and I get this error when I go to either the site or the forum:

Main Site:
Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server in /home/chevell1/public_html/wb/framework/class.database.php on line 61
Can't connect to local MySQL server - Too Many Connections

Forum:
Database connection error!
A connection to the Database could not be established.
Please check your username, password, database name and host.
Also make sure config.php is rightly configured!

my website is ChevelleOnline.net

If anyone could help me identify and fix this problem i would be greatful!
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: MySQL Too many connections

Post by josh »

the settings you want to adjust are located in a file called my.cnf, if you google about it you will find out a wealth of info about your problem.
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: MySQL Too many connections

Post by yacahuma »

There must be something wrong with your code or with the database. Are you in a share hosting? Are you sure you connect only once per page to your db?
Pmaurer
Forum Newbie
Posts: 5
Joined: Sat Sep 20, 2008 10:59 pm

Re: MySQL Too many connections

Post by Pmaurer »

Well......I did some more research and found this:

Drop the persistent connections. That should stop the "too many
connections" errors.

So, I had a chat with one of the Bluehost workers (apparently they don't let customers drop the persistent connections which is already a sign that they are a bad host)

PM [7:11:09 PM]: my site is constantly crashing with a "too many connections" error.....and i was researching and someone said to just drop the persistent connections...
JMiller [7:13:00 PM]: Sorry, but that is not doable on our servers.
PM [7:15:19 PM]: so......can't anyone help me with this problem.....i've been back and forth for literally months with your company about this problem....it's never ending.....isn't there some type of way to fix this....
JMiller [7:16:11 PM]: If you are getting that error a lot it may be time to upgrade to a dedicated server, which we unfortunately don't provide.

....So now I'm unsure as to what to do....I really can't just transfer to a new host easily....Is this what I would've wanted to do in order to get rid of the "too many connections error"? Is there any other way to fix it if so?
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: MySQL Too many connections

Post by yacahuma »

dont use persistent connections. for a normal site you will never see a performance hit.
Post Reply