作者:佚名 时间:2024-02-11 12:46:50 阅读:(15)
最近排查网站服务器慢日志,发现Mysql慢日志文件中有很多锁表的状态,接下来云梦编程为大家介绍一下mysql查看锁表方法,有需要的小伙伴可以参考一下:
[root@localhost ~]# mysql -uroot -p
mysql> SHOW STATUS LIKE 'Table_locks%'; +-----------------------+------------+ | Variable_name | Value | +-----------------------+------------+ | Table_locks_immediate | 2808829879 | | Table_locks_waited | 61782436 | +-----------------------+------------+ 2 rows in set (0.03 sec)
Table_locks_immediate参数表是锁表的总次数
Table_locks_waited 表示等待锁表的请求次数
mysql> show OPEN TABLES where In_use > 0; +----------------+-------------+--------+-------------+ | Database | Table | In_use | Name_locked | +----------------+-------------+--------+-------------+ | new_yundreams | web_game | 1 | 0 | | bbs_yundreams | web_gonglue | 1 | 0 | +----------------+-------------+--------+-------------+ 2 rows in set (0.01 sec)
以上就是云梦编程为大家介绍的关于Mysql查看锁表信息的方法,了解更多相关文章请关注云梦编程网!