MySQL : Permanently getting “ Waiting for table metadata lock”

后端 未结 3 1348
盖世英雄少女心
盖世英雄少女心 2020-12-25 14:51

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

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-25 15:37

    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:

    • not a bug on bugs.mysql
    • replication of lock on MyISAM and INNOdb tables

提交回复
热议问题