• ENGINE=MyISAM 不支持事务无法回滚


    mysql> show create table t6;
    +-------+----------------------------------------------------------------------------------------+
    | Table | Create Table                                                                           |
    +-------+----------------------------------------------------------------------------------------+
    | t6    | CREATE TABLE `t6` (
      `id` int(11) DEFAULT NULL
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
    +-------+----------------------------------------------------------------------------------------+
    1 row in set (0.03 sec)
    
    mysql> update t6 set id=2 where id=1;
    Query OK, 1 row affected (0.00 sec)
    Rows matched: 1  Changed: 1  Warnings: 0
    
    mysql> select * from t6;
    +------+
    | id   |
    +------+
    |    2 |
    +------+
    1 row in set (0.00 sec)
    
    mysql> rollback;
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> select * from t6;
    +------+
    | id   |
    +------+
    |    1 |
    +------+
    1 row in set (0.00 sec)
    
    ---------------------------------------------------------------------------------------------------
    
    
    
    
    mysql> create table t5(id int)  ENGINE=MyISAM ;
    Query OK, 0 rows affected (0.13 sec)
    
    mysql> desc t5
        -> ;
    +-------+---------+------+-----+---------+-------+
    | Field | Type    | Null | Key | Default | Extra |
    +-------+---------+------+-----+---------+-------+
    | id    | int(11) | YES  |     | NULL    |       |
    +-------+---------+------+-----+---------+-------+
    1 row in set (0.03 sec)
    
    mysql> show create table t5;
    +-------+----------------------------------------------------------------------------------------+
    | Table | Create Table                                                                           |
    +-------+----------------------------------------------------------------------------------------+
    | t5    | CREATE TABLE `t5` (
      `id` int(11) DEFAULT NULL
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
    +-------+----------------------------------------------------------------------------------------+
    1 row in set (0.00 sec)
    
    
    
    mysql> insert into t5 values(1);
    Query OK, 1 row affected (0.02 sec)
    
    mysql> commit;
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> select * from t5;
    +------+
    | id   |
    +------+
    |    1 |
    +------+
    1 row in set (0.02 sec)
    
    mysql> update t5 set id=2 where id=1;
    Query OK, 1 row affected (0.05 sec)
    Rows matched: 1  Changed: 1  Warnings: 0
    
    mysql> rollback;
    Query OK, 0 rows affected, 1 warning (0.00 sec)
    
    mysql> select * from t5;
    +------+
    | id   |
    +------+
    |    2 |
    +------+
    1 row in set (0.00 sec)
    
    ENGINE=MyISAM  不支持事务无法回滚
    

  • 相关阅读:
    财富平台项目日记1:spring boot + mybatis 实现分页查询
    Spring boot 跨域
    Mysql索引
    Java中list多对多拆分
    Redis持久化
    Windows下安装Redis
    idea 常用快捷键
    数据库事务
    Linux开启防火墙端口号
    nginx相关
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13351754.html
Copyright © 2020-2023  润新知