Mysql5.6版本有时增加表字段一直失败

参考:https://www.yht7.com/news/187610

通过performance_schema.metadata_locks 表来排查谁持有全局读锁,

select * from performance_schema.metadata_locks

查询threads表找出对应会话id:

select * from performance_schema.threads where THREAD_ID in (31,30)

通过information_schema.innodb_trx表确认源阻塞线程是否存在一个没有提交的事务
通过performance_schema.events_statements_current来查询某个线程正在执行或者最后一次执行完成的语句事件信息:

select * from information_schema.innodb_trx;
select * from performance_schema.events_statements_current where thread_id=11

找出谁持有表级锁:
找出持有表READ EXTERNAL表级锁的内部线程id

select * from performance_schema.table_handles where owner_thread_id!=0;

找出线程正在执行什么sql:

select * from performance_schema.events_statements_current where thread_id=30;

找出processlist_id来进行kill

select * from performance_schema.threads where THREAD_ID =30;

SHOW PROCESSLIST

你可能感兴趣的:(Mysql5.6版本有时增加表字段一直失败)