如何理解mysql innodb的行锁
这篇文章主要讲解了“怎么理解mysql innodb的行锁”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“怎么理解mysql innodb的行锁”吧! 基于索引上锁,而不是针对选出来的具体的行 root@sakila 10:14:32>show index from tab_no_index \G *************************** 1. row *************************** Table: tab_no_index Non_unique: 1 Key_name: id Seq_in_index: 1 Column_name: id Collation: A Cardinality: 5 Sub_part: NULL Packed: NULL Null: YES Index_type: BTREE Comment: Index_comment: 1 row in set (0.00 sec) 第一个会话 root@sakila 10:18:39>select * from tab_no_index where id=1 and name='1' for update; +------+------+ | id | name | +------+------+ | 1 | 1 | +------+------+ 1 row in set (0.00 sec) 第二个会话 root@sakila 10:18:42>select * from tab_no_index where id=1 and name='4' for update; ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction 感谢各位的阅读,以上就是“怎么理解mysql innodb的行锁”的内容了,经过本文的学习后,相信大家对怎么理解mysql innodb的行锁这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。 (编辑:银川站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |