查看MySQL的线程


通过两张表查看MySQL的线程:information_schema.processlist 和 performance_schema.threads

processlist是information_schema数据库中的一张临时表:

通过表结构,大概能猜出:表中每一条记录对应一个客户端连接,也对应一个线程,即MySQL数据库为每一个连接开一个线程。

kill pid; 命令杀死线程,但是客户端的连接还在。

而threads是一张普通表:

show full processlist 可以查看用户连接的线程。

如果想查看其它用户的线程,需要赋权限。如给root用户赋权限:grant process on *.* to root;

如果想查看MySQL的所有线程: select t.thread_id, t.name, t.type, t.processlist_id from performance_schema.threads t ;

processlist_id是information_schema.processlist表的id。

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM