Reputation: 12010
I'm getting this error:
Warning: mysql_connect() [function.mysql-connect]: Too many connections in /home1/host/public_html/employee/message/config.php on line 4
Could no connect to database. Too many connections
No one else is on my site at the moment. I'm the only one.
I do have a lot of AJAX, but the connections close after they're done. That is why I don't understand why I have a too many connections
error.
Upvotes: 1
Views: 4517
Reputation: 315
I had the same issue in a custom framework that I am using. The solution was to create one connection per http request (new mysqli).
Upvotes: 0
Reputation: 425
Make sure you close all existing database connections before making another connection. Do this by using the code $mysqlConnectionName->close();
or mysql_close($mysqlConnectionName);
Upvotes: 0
Reputation: 199
This issue is due to Multiple connection instance are active at a time. Use Singleton object for Connection object creation.
Upvotes: 0
Reputation: 2855
Can you try to see if connection closes properly after your do AJAX request by querying your MYSQL?
Upvotes: 2
Reputation: 3314
Are you using a webserver (IIS, Apache, etc)? They often pool the connections and hang on to them for a while to keep queries running fast. If you are, try restarting your webserver app (in IIS, Start -> Run "iisreset") and see if that frees it up.
Upvotes: 1