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:
If you happen to get similar error then try doing the following:
- Run the command "show processlist";
- 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:
- Run "show processlist".
- Check for all open mysql connections.
- Make sure you close all the connection except the one which you are connected by running kill id command.
- 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.