Bugzilla,一个开放源代码错误跟踪系统使用MySQL作为数据库。当您尝试将文档附加到大小超过1MB的错误时,您将收到以下错误消息。本文介绍了如何通过更改MySQL max_allowed_packet数据库参数和bugzilla 最大附件大小参数来解决此问题。
When a 的MySQL客户端 or the mysqld server receives a packet bigger than max_allowed_packet 通过tes, it issues a Packet too large error and closes the connection.
的MySQL客户端’s的默认max_allowed_packet值为16MB。 的MySQL服务器’s的默认max_allowed_packet为1MB。对于bugzilla附件,我们需要增加MySQL服务器的max_allowed_packet大小。
Bugzilla error message: The file you are trying to attach is 1396 kilobytes (KB) in size. Non-patch attachments cannot be more than 1000 KB. We recommend that you store your attachment elsewhere 上 the web, and then insert the URL to it in a comment, or in the URL field for this bug. Alternately, if your attachment is an image, you could convert it to a compressible format like JPG or PNG and try again.
1.在Bugzilla中更改maxattachmentsize参数
登录到bugzilla并单击“Parameters” link next to the “Edit”页脚区域。这将显示bugzilla配置菜单,如下所示。点击“Attachments”菜单项,显示所有与Bugzilla附件相关的配置参数。更改的值 最大附件大小 3MB限制为3000。
![[Bugzilla Configuration - 附件 menu items] [Bugzilla Configuration - 附件 menu items]](http://static.jnpkwjx.com/wp-content/uploads/2008/10/bugzilla-attachment-menu-item.jpg)
图 –Bugzilla配置菜单
最大附件大小 是非修补程序附件的最大大小(以千字节为单位)。 Bugzilla将不接受大于此千字节大小的附件。要接受任何大小的附件(取决于服务器软件的限制),请将此值设置为零。
2.更改MySQL数据库中的max_allowed_packet参数
加 max_allowed_packet = 3M 到MySQL配置文件:/etc/my.cnf,如下所示。
[db-server]# cat /etc/my.cnf [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql max_allowed_packet = 3M [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid [client] socket=/var/lib/mysql/mysql.sock
重新启动MySQL数据库,以使新的max_allowed_packet参数生效。
[db-server]# /etc/rc.d/init.d/mysqld restart Stopping 的MySQL: [ OK ] Starting 的MySQL: [ OK ]
进行上述两项更改后,您可以在bugzilla上上传最多3MB的附件。另外,有时候 恢复MySQL备份,您可能会收到以下错误消息。
Got a packet bigger than 'max_allowed_packet' 通过tes
要解决此问题,请如上所述将max_allowed_packet增加到32MB或更大。
如果您喜欢这篇文章,您可能还会喜欢..
![]() |
![]() |
![]() |
![]() |