MYSQL监控命令

一.性能监控

1.查看正在执行的进程

show processlist;

2.查看当前最大连接数

show variables like 'max_connections';

3.设置mysql 最大连接数(默认151 可以调大到512)

set global max_connections=1024;

4. 查看试图连接到MySQL

show status like 'connections';

5. 查看线程缓存内的线程的数量

show status like 'threads_cached';

 6.查看当前打开的连接的数量

show status like 'threads_connected';

7.查看创建用来处理连接的线程数

show status like 'threads_created';

8.查看激活的(非睡眠状态)线程数

show status like 'threads_running';

9.查看立即获得的表的锁的次数

show status like 'table_locks_immediate';

10.查看不能立即获得的表的锁的次数。

如果该值较高,并且有性能问题,你应首先优化查询,然后拆分表或使用复制。

show status like 'table_locks_waited';

 

猜你喜欢

转载自blog.csdn.net/weixin_38959210/article/details/107542855