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

相关文章
相关标签/搜索