• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 439
  • Last Modified:

too many connections

iam having a problem with mysql.

when i try to c onnect it says too many connections

how ever iam trying to solve it my restarting the server

but i want a permanent solution for it

any idea

my server is linux server
0
srikanthmadishetti
Asked:
srikanthmadishetti
1 Solution
 
Ivo StoykovCommented:
Hello srikanthmadishetti,

> too many connections
The number of connections allowed is controlled by the max_connections system variable. Its
default value is 100. If you need to support more connections, you should restart mysqld with a
larger value for this variable.

you can connect to the server and use SHOW PROCESSLIST to diagnose problems even if the maximum number of unprivileged clients are connected.

The maximum number of connections MySQL can support depends on the quality of the thread library
on a given platform. Linux or Solaris should be able to support 500-1000 simultaneous connections,
depending on how much RAM you have and what your clients are doing. Static Linux binaries
provided by MySQL AB can support up to 4000 connections.

HTH

I
0
 
Richard QuadlingSenior Software DeveloperCommented:
You could alter your scripts to use persistent connections. This is effectively 1 connection per server as long as the same credentials are used each time.

Also, if you are creating lots of result sets, you should free them too. By not freeing them, the sql server is maintaining connections without knowing that they are gone.

1 - mysql_query()
2 - mysql_fetch_array()
3 - mysql_free_result()

0
 
floorman67Commented:
other than what was stated ....

1. make sure there isnt a loop in your script opening up many connections.

2. ensure all open connections are closed (see #1 also)
0
2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

 
MortimerCatCommented:
Another reason could be that you are using persistent connections.

As PQuadling says, you get 1 connection per server as long as you use the same credentials. If you are using different credentials, then the number of connections builds up over time, and are only cleared by a reboot.

If this is the case, you need to use non-persistent connections.

Using PHP:

 pconnect = Persistent
 connect = Non-persistent



0
 
srikanthmadishettiAuthor Commented:
thanks for every one for nice suggestions each suggestion was great/
0
 
Richard QuadlingSenior Software DeveloperCommented:
Be careful. EVEN IF YOU USE CONNECT RATHER THAN PCONNECT IN AN ISAPI AND MAYBE FASTCGI, THE CONNECTION IS SHARED IF YOU USE THE SAME CREDENTIALS!!!!!!

Not good and contrary to what you think.
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now