【Linux】重生之从零开始学习运维之Mysql事务
事务
开启事务
begin;
提交事务
commit;
select * from stu;
事务回滚
begin;
select * from stu;
update stu set age=100 where id=10;
select * from stu;
rollback;
事务保存点
rollback to p2;
rollback to p1;
因回到p1,无后面记录,所以无法回到p2、p3保存点。
begin;
commit;
select * from stu;
begin;
select * from stu;
update stu set age=100 where id=10;
select * from stu;
rollback;
rollback to p2;
rollback to p1;
因回到p1,无后面记录,所以无法回到p2、p3保存点。