如何修改mysql autocommit

如何修改mysql autocommit,第1张

MySQLautocommit(自提交)默认启其mysql性能定影响举例说插入1000条数据mysqlcommit1000我autocommit关闭掉通程序控制要commit

1,我通set设置autocommit

查看复制打印?

mysql>set global init_connect="set autocommit=0"//提示用权限更高财户设置

ERROR 1227 (42000): Access deniedyou need (at least one of) the SUPER privilege(s) for this operation

mysql>set autocommit=0

Query OK, 0 rows affected (0.00 sec)

mysql>select @@autocommit//查看autocommit设置

+--------------+

| @@autocommit |

+--------------+

| 0 |

+--------------+

1 row in set (0.00 sec)

2,我修改mysql配置文件my.cnf关闭autocommit

查看复制打印?

[mysqld]

init_connect='SET autocommit=0' //mysqld面加些内容

用第二种关点要注意连接mysql用户权限能于启mysql用户权限init_connect='SET autocommit=0'根本启作用报任何错误汗先看实例

查看复制打印?

zhangy@ubuntu:~$ mysql -umysql

Welcome to the MySQL monitor. Commands end with or \g.

Your MySQL connection id is 1

Server version: 5.5.2-m2-log Source distribution

Type 'help' or '\h' for help. Type '\c' to clear the current input statement.

mysql>select @@autocommit//mysql启用户关闭autocommit功

+--------------+

| @@autocommit |

+--------------+

| 0 |

+--------------+

1 row in set (0.00 sec)

mysql>Ctrl-C -- exit!

Aborted

zhangy@ubuntu:~$ mysql -uroot

Welcome to the MySQL monitor. Commands end with or \g.

Your MySQL connection id is 2

Server version: 5.5.2-m2-log Source distribution

Type 'help' or '\h' for help. Type '\c' to clear the current input statement.

mysql>select @@autocommit//用root财户启功

+--------------+

| @@autocommit |

+--------------+

| 1 |

+--------------+

1 row in set (0.00 sec)

mysqlbug呢我网找找面问题真部内容:

If a user has SUPER privilege, init_connect will not execute

(otherwise if init_connect will a wrong query no one can connect to server).

Note, if init_connect is a wrong query, the connection is closing without any errors

and next command will clause 'lost connection' error.

面点说清楚If a user has SUPER privilege, init_connect will not execute用户更高级权限init_connect根本执行

Internal HDD 内置硬盘驱动器

首先,你在建表的时候是有owner的,你就要设置这个owner的权限。 展开数据库节点-用户-用户名上右键看属性-常规-权限。 此时显示目前数据库中所有表:绿色的对勾就是允许 *** 作。 如果不允许修改,点击“列”这个按钮

如何查看和设置Mysql的自动提交

方法/步骤

启动xampp中的mysql

登陆mysql

查看当前的autocommit属性值

命令

show variables like 'autocommit'\G

更改autocommit

命令:

set autocommit=off

查看更改后的autocommit值:

命令:

show variables like 'autocommit'

另一种设置autocommit值的途径

命令:

select @@autocommit

set autocommit=0


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/tougao/11152069.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-14
下一篇 2023-05-14

发表评论

登录后才能评论

评论列表(0条)

保存