(MySQL 5.5,InnoDB表)为什么我不能回滚,无论是保存点还是以前的begin语句?
mysql> set autocommit=0;
Query OK, 0 rows affected (0.00 sec)
mysql> start transaction;
Query OK, 0 rows affected (0.00 sec)
mysql> savepoint id;
Query OK, 0 rows affected (0.00 sec)
mysql> alter table sg_Section add column (published tinyint(1) default 0);
Query OK, 2 rows affected (0.30 sec)
Records: 2 Duplicates: 0 Warnings: 0
mysql> rollback to savepoint id;
ERROR 1305 (42000): SAVEPOINT id does not exist
Run Code Online (Sandbox Code Playgroud)
在保存点之后没有运行任何命令时,它似乎"工作":
mysql> savepoint id;
Query OK, 0 rows affected (0.00 sec)
mysql> rollback to savepoint id;
Query OK, 0 rows affected (0.00 sec)
Run Code Online (Sandbox Code Playgroud)
a_h*_*ame 10
DDL在MySQL中不是事务性的.
任何DDL语句都隐式提交open事务.
手册中的更多细节:http://dev.mysql.com/doc/refman/5.5/en/implicit-commit.html