1,Mysql5.6版本之前的解决方案: 查询表锁定的SQL语句: SELECT r.trx_id waiting_trx_id, r.trx_mysql_thread_id waiting_thread, r.trx_
查询表锁定的SQL语句:
SELECT
r.trx_id waiting_trx_id,
r.trx_mysql_thread_id waiting_thread,
r.trx_query waiting_query,
b.trx_id blocking_trx_id,
b.trx_mysql_thread_id blocking_thread
FROM
infORMation_schema.innodb_lock_waits w
INNER JOIN
information_schema.innodb_trx b ON b.trx_id = w.blocking_trx_id
INNER JOIN
information_schema.innodb_trx r ON r.trx_id = w.requesting_trx_id;
示例如下图:
MySQL5.7之后对锁表做了优化,查询表锁定的SQL语句比较简单,如下:
select * from sys.innodb_lock_waits;
示例如下图:
完结!!!
--结束END--
本文标题: MySQL锁表解决方案(亲测)
本文链接: https://lsjlt.com/news/7635.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0