Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2011

    Unhappy Unanswered: Find the number of active connections per database in MySQL

    Hello all,
    I have a drupal application that uses the database named db1. Each time a drupal request is sent, a new connection to database will be established.So after a certain number of conneections has reached the site turns offline showing the following error:

    User db1 already has more than 'max_user_connections' active connections.

    So my aim is to close the database connection and thereafter avoiding the offline error. For this I need to find the number of active connections made to my database.I have tried with the SHOW PROCESSLIST command. But it is not showing the number of connections.

    Is there any method to find the number of database connections made to a mysql database?


  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    dunno if a an application can make that request. the information is available as various tools including workbench display that.

    usually if you are hitting that sort of problem the best solutions are
    close what ever connections as possible once the app has terminated using the connections
    or if the app supports connection pooling use that
    or go back over you system metrics and workout what sort of load you are putting ont he server and decide if you need to increase the number of connections available to the server. this may have an impact on the underlying hardware (you may need more memory a better processor more bandwidth, less clutter on the server and or network).

    checking the design of the application software is usually a better way to go first, just increasing the number of connections available may be the final solution but you should check the application first
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Jul 2011
    Thanks for your reply.....
    I am trying to close the opened connections. That is the reason why I need to know the number of users connected to my database. By knowing this value I could confirm whether the connections are actually closed or not if I try to close it explicitly.

  4. #4
    Join Date
    Jul 2011
    MySQL Workbench can show you open connections.

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