2

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 |

2 Answers 2

1

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.

1
  • I had the exact same problem. Our mysql is at 5.5.25a. and myisam tables somehow get stuck with a metadata lock. I tried set global lock_wait_timeout=100; but that did not work. The only way I managed to kill the lock was to restart the mysql server.
    – Haluk
    Jul 27, 2012 at 21:48
0

I was trying to convert a table collation as follows:

 alter table xxx convert to character set utf8 collate utf8_unicode_ci;

I then noticed that on the "show full processlist" the request was freeze on the following state "Waiting for table metadata lock"

To resolve the issue, I opened another console in parallel and launched the following SQL command :

flush tables

Regards

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .