I am working right now with PHP website on my client's dedicated server and I get periodically an error too many connections but ~5 users are browsing this page.

In phpMyAdmin I can see that max connections variable is set to 400.

On our local MySQL server in my corporation we have max connections set to 200 and other mates uses in the same time this server.

I heard that on their server some other web is using the same MySQL with big trafiic.

Here are my questions:

  • How to debug this problem?
  • Can I look into some list of SQL queries that was executed in last 10 minutes to check if it is our problem or their?

1 Answer 1


The symptoms you describe point to persistent connections. In some setups PHP does not handle persistent connections very well: it tends to open new connections rather than reuse the existing ones. I suggest you disable this feature and see if the issue persists:

If you notice an improvement, you can try to fine tune persistent calls or get rid of them permanently.

  • I also shoot that case. At all I can not modify their web/server configuration to make that changes (my web does not uses persistent connections anywhere). Tomorrow I am going to meet their man and I will ask them to do that.
    – hsz
    Jan 18, 2010 at 15:26
  • This doesn't require modifying any server configuration. You would just need to update the PHP scripts for the application. Jan 18, 2010 at 15:37
  • Sure, but I have no access to the second webpage which is also using the same MySql server - so I can not update their PHP script that may uses mysql_pconnect. phpinfo() shows me that ` mysql.allow_persistent` is On. Changing that flag to Off will not give any results at all - it should be changet on their machine.
    – hsz
    Jan 18, 2010 at 15:46
  • They changed mysql.allow_persistent to Off and our CMS accelerated and now there are no problems with connections. Thanks! But I am still wondering how to check what scripts was connecting with MySql server?
    – hsz
    Jan 20, 2010 at 12:20
  • SHOW PROCESSLIST tells you the user, host, DB and (if you're lucky) query. Jan 20, 2010 at 16:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.