3 messages in com.mysql.lists.mysqlRe: Number of connections to a database
FromSent OnAttachments
Philippe de Rochambeau29 Nov 2004 05:03 
Wolfram Kraus29 Nov 2004 05:21 
Jon Stephens29 Nov 2004 07:01 
Subject:Re: Number of connections to a database
From:Jon Stephens (jo@mysql.com)
Date:11/29/2004 07:01:01 AM
List:com.mysql.lists.mysql

Date: Mon, 29 Nov 2004 14:03:32 +0100 To: mys@lists.mysql.com From: Philippe de Rochambeau <pder@iht.com> Subject: Number of connections to a database Message-Id: <122E@iht.com>

Hello,

is there any way to tell the number of simultaneous connections to a mysql database at a given time, using SQL or a scripting language such as php, perl, etc. ?

Many thanks.

Perhaps this will help.

mysql> SHOW STATUS LIKE 'threads_connected'; +-------------------+-------+ | Variable_name | Value | +-------------------+-------+ | Threads_connected | 5 | +-------------------+-------+ 1 row in set (0.00 sec)

mysql> SHOW STATUS LIKE '%connect%'; +----------------------+-------+ | Variable_name | Value | +----------------------+-------+ | Aborted_connects | 2 | | Connections | 74 | | Max_used_connections | 27 | | Threads_connected | 5 | +----------------------+-------+ 4 rows in set (0.00 sec)

Connections: Total number of connections made since the MySQL server was last restarted.

Max_used_conections: Maximum number of simultaneous connections since the MySQL server was last restarted.

Threads_connected: Current number of connections.