Common commands used to monitor MySQL database maintenance

  • 2020-05-30 21:11:50
  • OfStack

status = show status like '%%' [example :show status like 'Com_select']
variables = show variables like '%%' [example :show variables like 'query_cache_size']

1. Number of MySQL queries (status)
Com_select;Com_update;Com_insert;Com_delete;Com_change_db

2. Query cache space size :query_cache_size(variables)
Query cache maximum query data set size :query_cache_limit(variables);
Number of queries in the cache :Qcache_inserts(status);
Query cache hit ratio :(Qcache_hits/(Qcache_hits+Qcache_inserts)) *100% (status)

3. Index cache hit ratio
Index cache space size: key_buffer_size (variables)
Index cache hit ratio :(Key_reads/Key_read_requests)*100% (status)

4. Number of concurrent connections
Maximum allowable connections :max_connections(variables)
Actual maximum number of connections :max_used_connections(status)
Current number of connections :Threads_connected(status)
Number of active connections: Threads_running(status)
Number of cache connections: Threads_cache(status)

5. Flow statistics (status)
Bytes_received ,Bytes_sent(status)

6. Connection times
Connections per second :Connections(status)
Actual number of connections created per second: Threads_created(status)

7. Table lock statistics
Number of table locks immediately released: Table_locks_immediate(status)
Number of table locks to wait for: Table_locks_waited(status)


Related articles: