Pages

Wednesday, February 6, 2013

Mysql: Waiting for table metadata lock

While trying to execute alter table commands; lately it has started taking lot of time and hangs the server. It keeps executing the query and doesn't show any error. It took me a day to figure out a fix for this issue.

If you happen to get similar error then try doing the following:


  1. Run the command "show processlist";
  2. Run  'kill id" which shows this statement running.
This will terminate the command. But this is not the end of solution. Now while running the "Alter table" command; do the following:

  1. Run "show processlist".
  2. Check for all open mysql connections.
  3. Make sure you close all the connection except the one which you are connected by running kill id command.
  4. Now execute the "alter table" command
This worked for me and  I hope this will fix your problem of "waiting for table metadata lock" error.

No comments:

Post a Comment