mk-deadlock-logger - 查看mysql的死锁信息。安装方法可以参考这里。
有2种方式可以查看死锁信息。第一种方法是直接打印出来:

$ mk-deadlock-logger –source u=sg,p=xxxx,h=localhost –print
server ts thread txn_id txn_time user hostname ip db tbl idx lock_type lock_mode wait_hold victim query
localhost 2007-03-08T20:34:22 81 21309 29 baron localhost test c GEN_CLUST_INDEX RECORD X w 1 select * from c for update
localhost 2007-03-08T20:34:22 83 21310 19 baron localhost test a GEN_CLUST_INDEX RECORD X w [...]