怎么看MySQL开启的自动事务

当我们使用MySQL时,有时候我们需要开启自动事务,那么如何我们查看MySQL是否已经开启了自动事务呢?下面我们将介绍两种方法。

怎么看MySQL开启的自动事务

第一种方法:使用show variables命令查询

mysql>show variables like '%autocommit%'; +------------------------+-------+ | Variable_name | Value | +------------------------+-------+ | autocommit | ON | | automatic_sp_privileges| ON | +------------------------+-------+ 2 rows in set (0.02 sec)