默认隔离级别:可重复读
原始数据
| id | name | addr |
| 6 | nick | NULL | 事务1 事务2 start transaction start transaction select * from t_user where id=6;
// name = nick update t_user set name='lock' where id=6 select * from t_user where id=6;
// name = nick
commit; select * from t_user where id=6;
// name = nick
// 即使第1个事务已经提交数据,此事务中查询的结果仍然是旧值
commit; select * from t_user where id=6;
// name = lock
脏读 read uncommit 第一个事务还没提交, 第二个事务就读出来了, 如果第一个事务回滚了,第二个事务读的就是错误数据
不可重复读 read commit, 第一个事务提交之后,第二个事务可以立即查询出来,造成事务二两次读取结果可能不一样
幻读 可重复读 repeat read, 第一个事务提交之后,第二个事务读取的仍是事务开始时的值---保持不变
序列化 第一个事务做更新时,第二个事务读取不了 2 3 的区别 https://blog.****.net/v123411739/article/details/39298127