Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我立即执行时START TRANSACTION,SHOW VARIABLES LIKE 'autocommit'我看到变量autocommit仍然设置为ON. OFF在我明确说之前,这不是应该设置的COMMIT吗?
START TRANSACTION
SHOW VARIABLES LIKE 'autocommit'
autocommit
ON
OFF
COMMIT
来源:http ://dev.mysql.com/doc/refman/5.0/en/commit.html
据我了解,交易只是忽略了自动提交设置。所以开始一个事务不会改变自动提交变量的值。这是有道理的,因为您不希望用户 a 的事务在处理用户 a 的事务时禁用用户 b 的自动提交。
这通过阅读文档并不明显,除非您将“自动提交模式”和“自动提交变量”视为两个不同的东西,它们是。