mysql禁用autocommit
来源:互联网 发布:平刷王时时彩软件怎样 编辑:程序博客网 时间:2024/06/05 19:03
mysql默认开启auto commit,我们可以通过系统变量控制来动态控制session级别autocommit
(set autocommit = 0|1),
如何从全局禁用autocommit呢,也许有时候我们不想让mysql自动提交。
mysql有一个Cmd-Line&Option file&System Var可以帮助我们实现这样的功能,它就是init_connect。
这个参数用来定义每个session建立时自动执行的query。
A string to be executed by the server for each client that connects. The string consists of one or more SQL statements. To specify multiple statements, separate them by semicolon characters.A string to be executed by the server for each client that connects. The string consists of one or more SQL statements. To specify multiple statements, separate them by semicolon characters.
利用这个变量,可以通过如下方式禁用autocommit:
way1:mysql>SET GLOBAL init_connect=’SET autocommit=0′;
way2:在初始化参数文件中设置
[mysqld]
init_connect=’SET autocommit=0′
way3:
启动mysql时带上命令行参数–init_connect=’SET autocommit=0′
当然这个参数的设置对拥有super权限的用户是无效的,具体说明
(set autocommit = 0|1),
如何从全局禁用autocommit呢,也许有时候我们不想让mysql自动提交。
mysql有一个Cmd-Line&Option file&System Var可以帮助我们实现这样的功能,它就是init_connect。
这个参数用来定义每个session建立时自动执行的query。
A string to be executed by the server for each client that connects. The string consists of one or more SQL statements. To specify multiple statements, separate them by semicolon characters.A string to be executed by the server for each client that connects. The string consists of one or more SQL statements. To specify multiple statements, separate them by semicolon characters.
利用这个变量,可以通过如下方式禁用autocommit:
way1:mysql>SET GLOBAL init_connect=’SET autocommit=0′;
way2:在初始化参数文件中设置
[mysqld]
init_connect=’SET autocommit=0′
way3:
启动mysql时带上命令行参数–init_connect=’SET autocommit=0′
当然这个参数的设置对拥有super权限的用户是无效的,具体说明
Note that the content of init_connect is not executed for users that have the SUPER privilege. This is done so that an erroneous value for init_connect does not prevent all clients from connecting. For example, the value might contain a statement that has a syntax error, thus causing client connections to fail. Not executing init_connect for users that have the SUPER privilege enables them to open a connection and fix the init_connect value.
整理自网络
0 0
- mysql禁用autocommit
- mysql禁用autocommit
- mysql禁用autocommit,以及遇到的问题
- mysql禁用autocommit,以及遇到的问题
- mysql禁用autocommit,以及遇到的问题
- MySQL autocommit
- mysql 中的 autocommit 变量
- mysql的autocommit
- mysql commit rollback autocommit
- mysql的autocommit详解
- MySQL事务autocommit自动提交
- MySQL事务autocommit自动提交
- MySQL事务autocommit自动提交
- autocommit(自动提交) mysql
- MySQL事务autocommit自动提交
- MySQL事务autocommit自动提交
- autocommit
- mysql中的set autocommit =0
- 以太网网络变压器和中心抽头的接法
- php扩展xdebug基本使用
- C#6.0的语法<一>
- bzoj [HAOI2008] 糖果传递 贪心
- 安装win8后找不到Ubuntu启动项的解决方法
- mysql禁用autocommit
- 新手学跨域之Jsonp
- 新浪云存储(SCS) SDK for Node.js使用方法,node粉丝这次有福气了!
- SQLite使用
- 新浪云存储支持云豆支付吗?
- C 的输入输出流和缓冲区
- JAVA分布式事务小结
- 设计模式之适配器模式
- Qt学习之路之文件浏览器