image.png
    查看当前事务隔离级别

    image.png

    设置事务隔离级别为read uncommitted

    image.png

    image.png

    image.png

    3.如何解决并发问题?
    通过设置隔离级别

    事务的隔离级别:
    脏读 不可重复读 幻读
    read uncommitted: √ √ √
    read committed: × √ √
    repeatable: × × √
    serializable: × × ×

    mysql中默认第三个隔离级别 repeatable read
    Oracle中默认第二个隔离级别 read committed
    查看隔离级别
    select @@tx_isolation;
    设置隔离级别
    set session | global transaction isolation level 隔离级别;
    */

    *
    savepoint 节点名; #设置保存点

    #演示savepoint 的使用
    SET autocommit=0;
    START TRANSACTION;
    DELETE FROM account WHERE id=25;
    SAVEPOINT a;#设置保存点
    DELETE FROM account WHERE id=28;
    ROLLBACK TO a;#回滚到保存点