1

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

simplfuzz
  • 249
  • 4
  • 9

2 Answers2

1

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.

nikb
  • 331
  • 1
  • 3
1

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.

golan
  • 134
  • 3