Mysql – show thesql theisam locks

MySQL

when dropping or renaming a table with myisam storage engine, I realize that it's waiting for table metadata lock, however, show full processlist doesn't reveal the offending query. any idea?

| 462 | root | xxx.xxx.xxx.xx:54658 | mydb | Sleep   | 1162 |                                 | NULL                                                 |
| 465 | root | localhost           | mydb | Query   |    0 | NULL                            | show full processlist                                |
| 466 | root | localhost           | mydb | Query   |  125 | Waiting for table metadata lock | alter table mytable rename to mytable_junk |

Best Answer

If you are using MySQL 5.5, there is a bug report on it.

If fact, click here for an explanation of metadata locking. It is meant to protect tables from getting DDL executed against it while in the middle of a transaction.

What seems strange is that you are getting this on a MyISAM table.

Related Topic