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
LVL 13
srikanthmadishettiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.