mysql 数据库表锁死_mysql 数据库表被锁住了_Mysql数据库表锁死如何处理?
處理方式有如下三種:
1.查詢(xún)不是sleep或者有狀態(tài)的sql
select * from `information_schema`.processlist where command !='Sleep' or state !=''
2.查詢(xún)運(yùn)行中的事務(wù)
select trx_state, trx_started, trx_mysql_thread_id, trx_query from information_schema.innodb_trx
3.查看死鎖
SELECT b.trx_state, e.state, e.time, d.state AS block_state, d.time AS block_time
, a.requesting_trx_id, a.requested_lock_id, b.trx_query, b.trx_mysql_thread_id, a.blocking_trx_id
, a.blocking_lock_id, c.trx_query AS block_trx_query, c.trx_mysql_thread_id AS block_trx_mysql_tread_id
FROM information_schema.INNODB_LOCK_WAITS a
LEFT JOIN information_schema.INNODB_TRX b ON a.requesting_trx_id = b.trx_id
LEFT JOIN information_schema.INNODB_TRX c ON a.blocking_trx_id = c.trx_id
LEFT JOIN information_schema.PROCESSLIST d ON c.trx_mysql_thread_id = d.id
LEFT JOIN information_schema.PROCESSLIST e ON b.trx_mysql_thread_id = e.id
ORDER BY a.requesting_trx_id
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎(jiǎng)勵(lì)來(lái)咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎(jiǎng)總結(jié)
以上是生活随笔為你收集整理的mysql 数据库表锁死_mysql 数据库表被锁住了_Mysql数据库表锁死如何处理?的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 屏蔽广告方法(Adblock 插件)
- 下一篇: hive与mysql对比之max、gro