MySQL drop空表時處於Waiting for table metadata lock狀態,解決辦法 (出自網絡)

MySQL drop空表時處於Waiting for table metadata lock狀態,簡單粗暴的解決辦法,原理性請看官網mysql

1.  mysql> select concat("kill ",b.ID,";") as kill_id from information_schema.INNODB_TRX a,information_schema.PROCESSLIST b where a.trx_mysql_thread_id=b.ID and a.trx_state='RUNNING' and b.TIME >=30;

2. mysql> select concat("kill ",trx_mysql_thread_id,";") as kill_id from information_schema.INNODB_TRX where trx_lock_structs=0 and trx_weight=0 and trx_rows_locked=0 and trx_rows_modified=0 and trx_state='RUNNING';

以上兩步任選其一
mysql> kill kill_idsql

這種辦法屬於治標不治本,只是臨時性解決orm

相關文章
相關標籤/搜索