Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

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 http://dev.mysql.com/doc/refman/5.0/en/server-status-variables.html#statvar_Connections 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

 
discard

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.