Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2016

    Unanswered: How to know what MySQL queries are causing this error message?

    I found this topic: But by the moments that is the limit of connections, I have not access to my server, which displays error messages:

    ERROR: Zend_Db_Adapter_Exception: SQLSTATE[08004] [1040] Too many connections (Abstract.php:144)

    ERROR: PleskDBException: Unable to connect to database: mysql_connect(): Too many connections (Error code: 1040) (Abstract.php:69)

    How to know which queries were being made at the time that my server was unavailable?

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    This error occurs when you have a rogue program (or programer) NOT closing connections when they are done with them or not freeing connection objects before a script or program terminates. Or it could just be the server is getting blitzed with requests and cannot cope.

    If the server is getting blitzed with too many concurrent requests then relevant setting in the server needs adjusting and the server restarting, or the load on the server needs rebalancing (either beef up the server and or split the workload onto other servers ) talk to you ISP or whoever provides the server (s)

    Its unusual to be caused inside a PHP application as PHP is supposed to clear up such things automatically, but Id suggest its good practice to always close objects yourself just in case something slips through in someone else's code.

    When I have hit this problem before its always been a rogue program in another language thats done the dirty deed, but the PHP script reports the error when it tries to secure the resources it needs. It is possible inside a PHP script to trigger this if say you create a connection inside a loop so essentially the same connection gets created on each iteration of the loop, which is bad bad design.

    Lastly consider if you should be using connection pooling
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Sep 2002
    Montreal, Canada
    Provided Answers: 1
    Don't you check for errors after sending a query to the server ?????????? That is a MUST!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts