Mysql 关闭自动commit

Posted 东篱

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mysql 关闭自动commit相关的知识,希望对你有一定的参考价值。

1、

  • 会话级关闭自动提交  
  1. mysql> set autocommit=off;  
  2. Query OK, 0 rows affected (0.00 sec)  
  3. mysql>  show variables like ‘autocommit‘;  
  4. +---------------+-------+  
  5. | Variable_name | Value |  
  6. +---------------+-------+  
  7. | autocommit    | OFF   |  
  8. +---------------+-------+  
  9. 1 row in set (0.00 sec)  

2、@@autocommit为0表示off,为1表示on

  1. mysql> select @@autocommit;   //查看一下autocommit的设置  
  2. +--------------+  
  3. | @@autocommit |  
  4. +--------------+  
  5. |            0 |  
  6. +--------------+  
  7. 1 row in set (0.00 sec)  

以上是关于Mysql 关闭自动commit的主要内容,如果未能解决你的问题,请参考以下文章