SET GLOBAL max_allowed_packet不起作用 [英] SET GLOBAL max_allowed_packet doesn't work
问题描述
我发现了如何使用SET GLOBAL
更改MySQL中max_allowed_packet
的默认值.但是,每次使用此命令时,默认值都保持不变!
我使用了以下命令:
I found out how to change the default value of max_allowed_packet
in MySQL using SET GLOBAL
. However, each time I used this command, the default value stayed untouched!
I used these commands:
mysql --user=root --password=mypass
mysql> SET GLOBAL max_allowed_packet=32*1024*1024;
Query OK, 0 rows affected (0.00 secs)
mysql> SHOW VARIABLES max_allowed_packet;
然后结果是max_allowed_packet =1048576.我缺少什么?
And then the result is max_allowed_packet = 1048576. What am I missing?
推荐答案
Hmmmm.. You have hit this NOT-A-BUG it seems. :)
如果更改全局系统变量,则该值将被记住并用于新的 连接,直到服务器重新启动. (进行全局系统变量设置 永久,则应将其设置在选项文件中.) 访问该全局变量.但是,更改会影响相应的会话 变量仅适用于更改后连接的客户端.全局变量更改确实 不会影响当前连接的任何客户端的会话变量(甚至不会影响 发出SET GLOBAL语句的客户).
If you change a global system variable, the value is remembered and used for new connections until the server restarts. (To make a global system variable setting permanent, you should set it in an option file.) The change is visible to any client that accesses that global variable. However, the change affects the corresponding session variable only for clients that connect after the change. The global variable change does not affect the session variable for any client that is currently connected (not even that of the client that issues the SET GLOBAL statement).
也请参考此.阅读Shane Bester的说明.
Refer this too. Read Shane Bester explanation.
您应该从my.ini/my.cnf文件中更改并重新启动服务器,以使max_allowed_packet设置生效.
You should change from the my.ini/my.cnf file and restart the server for the max_allowed_packet setting to take effect.
这篇关于SET GLOBAL max_allowed_packet不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!