MySQL drop空表时处于Waiting for table metadata lock状态,解决办法

来源:互联网 发布:怎么可以微信扫淘宝店 编辑:程序博客网 时间:2024/05/16 12:46
#将以下语句修改一下后复制粘贴到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 -P3320"
db_conn -ss -e "selectconcat(\"kill \",trx_mysql_thread_id,\";\") as kill_id frominformation_schema.INNODB_TRX where trx_lock_structs=0 andtrx_weight=0 and trx_rows_locked=0 and trx_rows_modified=0 andtrx_state='RUNNING';"|db_conn

0 0