Mysql: Waiting for table metadata lock

Автор | 10.03.2016

In Mysql shell execute:

SHOW ENGINE INNODB STATUS \G

Look for the Section –

 TRANSACTIONS

Find transaction like:

---TRANSACTION 242390461, ACTIVE 11479 sec
1246 lock struct(s), heap size 139472, 86165 row lock(s), undo log entries 13100
MySQL thread id 55443, OS thread handle 139631267161856, query id 62644999   cleaning up
Trx read view will not see trx with id >= 242378242, sees < 242341382

In my case Thread 55443 looks like:

| Id    | User | Host | db | Command | Time   | State  | Info |
| 55443 |  | :14925 |   | Sleep | 0 | | NULL

Thread already dead with time=0 but lock table during 11479sec, so we kill them

mysql > kill 55443 ;

Залишити відповідь