My MySQL database serves three webapps as the storage backend. However I recently encounter permanantly the error \"Waiting for table metadata lock\". It happen nearly all t
Kill the connection with lock
Kill 1398
Then check if you have autocommit set to 0 by
select @@autocommit;
If yes, you propably forgot to commit transaction. Then another connection want to do something with this table, which causes the lock.
In your case: If you made some query to LogEntries (whitch exists) and did not commit it, then you try to execute CREATE TABLE IF NOT EXISTS from another connection - metadata lock happens.
edit For me the bug is somewhere at your application. Check there, or set autocommit to 1 if your not using transactions in application.
ps also check this posts: