當前位置:首頁 > IT技術(shù) > 數(shù)據(jù)庫 > 正文

MySQL表被鎖了怎么辦
2021-09-24 14:42:53

如果MySQL表被鎖了怎么辦?可以在數(shù)據(jù)庫連接工具中執(zhí)行下面這個語句。

select * from information_schema.innodb_trx

+----------+-----------+---------------------+-----------------------+------------------+------------+---------------------+-----------+---------------------+-------------------+-------------------+------------------+-----------------------+-----------------+-------------------+-------------------------+---------------------+-------------------+------------------------+----------------------------+---------------------------+---------------------------+------------------+----------------------------+
| trx_id | trx_state | trx_started | trx_requested_lock_id | trx_wait_started | trx_weight | trx_mysql_thread_id | trx_query | trx_operation_state | trx_tables_in_use | trx_tables_locked | trx_lock_structs | trx_lock_memory_bytes | trx_rows_locked | trx_rows_modified | trx_concurrency_tickets | trx_isolation_level | trx_unique_checks | trx_foreign_key_checks | trx_last_foreign_key_error | trx_adaptive_hash_latched | trx_adaptive_hash_timeout | trx_is_read_only | trx_autocommit_non_locking |
+----------+-----------+---------------------+-----------------------+------------------+------------+---------------------+-----------+---------------------+-------------------+-------------------+------------------+-----------------------+-----------------+-------------------+-------------------------+---------------------+-------------------+------------------------+----------------------------+---------------------------+---------------------------+------------------+----------------------------+
| 96210480 | RUNNING | 2021-08-26 11:33:51 | NULL | NULL | 0 | 1815922 | NULL | NULL | 0 | 0 | 0 | 360 | 0 | 0 | 0 | REPEATABLE READ | 1 | 1 | NULL | 0 | 10000 | 0 | 0 |
+----------+-----------+---------------------+-----------------------+------------------+------------+---------------------+-----------+---------------------+-------------------+-------------------+------------------+-----------------------+-----------------+-------------------+-------------------------+---------------------+-------------------+------------------------+----------------------------+---------------------------+---------------------------+------------------+----------------------------+
1 row in set (0.34 sec)

找到 trx_mysql_thead_id 執(zhí)行kill命令

kill 1815922

站在巨人肩膀上摘蘋果

https://blog.csdn.net/tangthh123/article/details/104391170

本文摘自 :https://www.cnblogs.com/

開通會員,享受整站包年服務(wù)立即開通 >