- mysql> select * from test;
- +----+------+
- | id | a |
- +----+------+
- | 1 | 1 |
- | 2 | 2 |
- | 4 | 4 |
- +----+------+
- 3 rows in set (0.00 sec)
出现逝世锁的操作如下:
步调 事务 1 事务 2 1 begin 2 delete from test where a = 2; 3 begin 4 delete from test where a = 2; (事务 1 卡住) 5 提示出现逝世锁:ERROR 1213 (40001): Deadlock found when trying to get lock; try restarting transaction insert into test (id, a) values (10, 2);
然后我们可以经由过程 SHOW ENGINE INNODB STATUS; 来查看逝世锁日记:
- ------------------------
- LATEST DETECTED DEADLOCK
- ------------------------
- 170219 13:31:31
- *** (1) TRANSACTION:
- TRANSACTION 2A8BD, ACTIVE 11 sec starting index read
- mysql tables in use 1, locked 1
推荐阅读
大年夜家之所以会去选择轻薄本,无疑是看中了便携这一特点,但这类标记本往往为了续航和散热等方面推敲,机能会有大年夜幅缩水,要想比较流畅地处理大年夜数据量的工作文件或玩游戏都是根本不太行的。 >>>详细阅读
本文标题:记一次MySQL死锁排查过程
地址:http://www.17bianji.com/lsqh/39935.html
1/2 1