Counting the number of select statements, connections for each user in MySQL

How can I count the number of connections and user requests per day? I need a small list of users previously registered on my MySQL server, with a total number of queries and connections.

For instance:

users | Queries
user01 | 120000
user02 | 340000
user03 | 1540000
user04 | 1244000

thank

+3
source share
1 answer

You cannot query this information directly from MySQL, but you can enable the general query log and analyze that it includes connection information and logs requests made by these connections.

. :
http://dev.mysql.com/doc/refman/5.1/en/query-log.html

: .

.
.
100215 16:16:09    2 Connect    root@localhost on
                   2 Query      select @@version_comment limit 1
100215 16:18:54    2 Query      select "Hello, StackOverflow"
100215 16:19:48    2 Query      select * from table
.
.
+3

Source: https://habr.com/ru/post/1732832/


All Articles