对应的关键字:
Waiting for table metadata lock
主要的命令如下:
show processlist;
kill 10086;
select * from information_schema.innodb_trx\G;
查processlist和kill
mysql> show processlist;
+----+-----------+-----------------------+-----------+---------+------+---------------------------------+------------------------------------------------------------------------------------------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+-----------+-----------------------+-----------+---------+------+---------------------------------+------------------------------------------------------------------------------------------------------+
| 85 | financial | DESKTOP-82CT4I6:59226 | financial | Sleep | 209 | | NULL |
| 86 | root | localhost:59239 | financial | Query | 44 | Waiting for table metadata lock | Alter table `financial`.`fund_open_price_year_2021`
change `fundId` `fund_id` varchar(32) CHAR |
| 87 | root | localhost:59240 | NULL | Sleep | 55 | | NULL |
| 89 | root | localhost:59249 | NULL | Query | 0 | starting | show processlist |
+----+-----------+-----------------------+-----------+---------+------+---------------------------------+------------------------------------------------------------------------------------------------------+
4 rows in set (0.00 sec)
mysql> kill 86;
Query OK, 0 rows affected (0.00 sec)
查未提交的事务查询
mysql> select * from information_schema.innodb_trx\G;
*************************** 1. row ***************************
trx_id: 283818627624448
trx_state: RUNNING
trx_started: 2022-02-15 15:26:30
trx_requested_lock_id: NULL
trx_wait_started: NULL
trx_weight: 0
trx_mysql_thread_id: 85
trx_query: NULL
trx_operation_state: NULL
trx_tables_in_use: 0
trx_tables_locked: 0
trx_lock_structs: 0
trx_lock_memory_bytes: 1136
trx_rows_locked: 0
trx_rows_modified: 0
trx_concurrency_tickets: 0
trx_isolation_level: REPEATABLE READ
trx_unique_checks: 1
trx_foreign_key_checks: 1
trx_last_foreign_key_error: NULL
trx_adaptive_hash_latched: 0
trx_adaptive_hash_timeout: 0
trx_is_read_only: 0
trx_autocommit_non_locking: 0
1 row in set (0.00 sec)
ERROR:
No query specified
mysql> kill 85;
Query OK, 0 rows affected (0.00 sec)
版权说明 : 本文为转载文章, 版权归原作者所有 版权申明
原文链接 : https://it1995.blog.csdn.net/article/details/123568231
内容来源于网络,如有侵权,请联系作者删除!