MySQL drop空表时处于Waiting for table metadata lock状态,解决办法
Posted on 2015-09-11 09:25 DBA日志小记 阅读(241) 评论(0) 编辑 收藏 举报#将以下语句修改一下后复制粘贴到linux命令行
方法1:
alias db_conn="mysql -h 127.0.0.1 -uroot -proot@123 -P 3320"
db_conn -ss -e "
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; "|db_conn
方法2:
alias
db_conn="mysql -h 127.0.0.1 -uroot -proot@123 -P
3320"
db_conn -ss -e "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';"|db_conn
版权声明:QQ:597507041