总所周知,mysql查看当前连接状态最常用的有
- mysqladmin -u root -p'123456' processlist
- mysqladmin -u root -p'123456' status
Uptime: 1214649 Threads: 1 Questions: 18565903 Slow queries: 580 Opens: 185291 Flush tables: 1 Open tables: 64 Queries per second avg: 15.285
3.
mysqladmin -h127.0.0.1 -u root -p'7232275' proc stat(上述两个命令的集合)
+--------+------+-----------------+----+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+--------+------+-----------------+----+---------+------+-------+------------------+
| 266813 | root | 127.0.0.1:47183 | | Query | 0 | | show processlist |
+--------+------+-----------------+----+---------+------+-------+------------------+
Uptime: 1214711 Threads: 1 Questions: 18566703 Slow queries: 580 Opens: 185292 Flush tables: 1 Open tables: 64 Queries per second avg: 15.285
同事又问我,
mysql> show status like "Threads%";
+-------------------+--------+
| Variable_name | Value |
+-------------------+--------+
| Threads_cached | 0 |
| Threads_connected | 1 |
| Threads_created | 266901 |
| Threads_running | 1 |
+-------------------+--------+
前几条命令显示的Threads,和show status like "Threads%"显示哪个对应呢?或者根本是两回事?
经过查阅mysql手册,发现Threads和show status like "Threads_running";是相对应的,请参考手册:
http://dev.mysql.com/doc/refman/5.1/en/mysqladmin.html
Threads
The number of active threads (clients).
http://dev.mysql.com/doc/refman/5.1/en/server-status-variables.html#statvar_Threads_created
Threads_running
The number of threads that are not sleeping.
阅读(1492) | 评论(0) | 转发(0) |