第 9 章 · 上机一
先确认两扇窗口连的是同一台服务器
A 改一行提交,B 那边立刻就看得见。
对应讲义第 5 页 自动提交模式
窗口 A
Welcome to the MySQL monitor. Commands end with ;
Server version: 8.0.36 MySQL Community Server - GPL
上下两扇窗口是同一台服务器上的两个会话。拿不到锁的那句会卡住,等对方放手才接着跑。
mysql>
窗口 B
Welcome to the MySQL monitor. Commands end with ;
Server version: 8.0.36 MySQL Community Server - GPL
mysql>
这一句敲进窗口 A
重 点
没开事务的时候每一句自己就是一笔事务,敲完立刻落地,B 马上看得见。
想一想
A 那句 UPDATE 后面并没有写 COMMIT,为什么 B 也看得到?