Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I find out how many connections were made to the mysql server in a given duration?

share|improve this question
up vote 1 down vote accepted

What I'd do rather than enabling log (which can be very IO intensive on big production servers) is to have a look at the output of SHOW STATUS. With that you can have a look at the connections variable (and lot others, usually broken down per type). So you can have a look at that number at a given time and later on, and find out how many connections were made.

Have a look at and friends.

Best bet is also to have some kind of graphing from these values.

share|improve this answer

Start mysqld with --log to enable the general query log. Then use grep to find the appropriate timespan and search for/count connections.

The general query log tends to grow quickly, and you might want to turn it on only for bugfixing. If you keep it on, you need to roll/truncate the logs frequently.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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