MySQL 如何在 phpmyadmin 中设置 max_allowed_packet?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17536425/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to set max_allowed_packet in phpmyadmin?
提问by user1390378
I have to change max_allowed_packet
size in MySQL using phpmyadmin
, but I don't know how to do it. When I try set global max_allowed_packet=10M
in phpmyadmin
it give this error
我必须使用 更改max_allowed_packet
MySQL 中的大小phpmyadmin
,但我不知道该怎么做。当我尝试set global max_allowed_packet=10M
在phpmyadmin
它给这个错误
#1227 - Access denied; you need the SUPER privilege for this operation
I can't get SUPER privilege, because server is not in my control.
我无法获得超级特权,因为服务器不在我的控制之下。
So, How can I change it?
那么,我该如何改变呢?
采纳答案by RandomSeed
You cannot.
你不能。
To change it dynamically, as with the SET
you tried, you need the SUPER
privilege, there is no way around it. And this is a good thing, because 1. the setting is global, which means it affects allconnections, and 2. it might jeopardize the server (it makes it easier to DoS a server, for example).
要动态更改它,就像SET
您尝试过的那样,您需要SUPER
特权,没有办法绕过它。这是一件好事,因为 1. 该设置是全局的,这意味着它会影响所有连接,以及 2. 它可能会危及服务器(例如,它可以更轻松地对服务器进行 DoS)。
To set it permanently, you need access to the MySQL configuration file and be able to restart the service, as Zak advises.
要永久设置它,您需要访问 MySQL 配置文件并能够重新启动服务,正如 Zak 建议的那样。
The real question is, however, why do you need such a high limit. Unless you are trying to import a large dump, having a need for such a limit almost always suggests something was wrongly designed in the first place. If you are importing a dump, try to import smaller bits at a time.
然而,真正的问题是,为什么需要这么高的限制。除非您尝试导入大型转储,否则需要这样的限制几乎总是表明首先设计错误。如果您要导入转储,请尝试一次导入较小的位。
回答by Zak
You will have to set this in MySQL as well .. Generally found here:
您还必须在 MySQL 中进行设置。通常可以在这里找到:
/etc/mysql/my.cnf
Example:
例子:
max_allowed_packet = 16M
If the server is not in your control, you are going to have to ask for access to said file.
如果服务器不在您的控制之下,您将不得不请求访问所述文件。
回答by user4560259
You can change variables from the "Server variables and settings" page, which is accessible via "Variables" at the top or at [server]/phpmyadmin/server_variables.php
您可以从“服务器变量和设置”页面更改变量,该页面可通过顶部的“变量”或 [server]/phpmyadmin/server_variables.php 访问
Look up "max_allowed_packet", and hit Edit - default is 4194304
(4MB, in bytes).
查找“max_allowed_packet”,然后点击编辑 - 默认为4194304
(4MB,以字节为单位)。