查看锁等信息,包括锁信息:
select "HOLD:",ph.id h_processid,trh.trx_id h_trx_id,trh.trx_started h_started,trh.trx_state h_state,lsh.lock_table h_table,lsh.lock_index h_index,lsh.lock_mode as h_lock_mode,lsh.lock_type h_lock_type,ph.user h_user,ph.host h_host,ph.command p_command,ph.info p_info,"WAIT:",pw.id w_processid,trw.trx_id w_trx_id,trw.trx_started w_started,trw.trx_state w_state,lsw.lock_table w_table,lsw.lock_index w_index,lsw.lock_mode  w_lock_mode,lsw.lock_type w_lock_type,pw.user w_user,pw.host w_host,pw.command w_command,pw.info w_info from information_schema.INNODB_LOCK_WAITS lw  inner join information_schema.INNODB_TRX trh on trh.trx_id=lw.blocking_trx_id inner join information_schema.PROCESSLIST ph on trh.trx_mysql_thread_id=ph.id  left join information_schema.INNODB_LOCKS lsh on lsh.lock_trx_id=trh.trx_id  inner join  information_schema.INNODB_TRX trw on trw.trx_id=lw.requesting_trx_id inner join information_schema.PROCESSLIST pw on trw.trx_mysql_thread_id=pw.id  left join information_schema.INNODB_LOCKS lsw on lsw.lock_trx_id=trw.trx_id ;
 
查找当前进程的执行状态:
SELECT    a.trx_id,   trx_state,   trx_started,   b.id AS thread_id,   b.info,   b.user,   b.host,   b.db,   b.command,   b.state  FROM   information_schema.`INNODB_TRX` a,   information_schema.`PROCESSLIST` b  WHERE a.trx_mysql_thread_id = b.id  ORDER BY a.trx_started;
05-11 02:36