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 不支持事务无法回滚