问题描述
我的应用程序通过IMAP下载邮件并将其存储在MySQL数据库中.早些时候,我支持的邮件大小最大为10 MB,因此用于存储邮件内容的"mediumtext"列就足够了.现在,我需要支持最大30MB的邮件.所以我将列的数据类型更改为"largetext".昨天存储了大小为25 MB的邮件.之后,每当我执行mysqldump命令时,它都会引发错误:
My application download mails over IMAP and stores them in a MySQL database. Earlier I was supporting mails size upto 10 MB and hence a 'mediumtext' column to store the mail content was enough. Now I need to support mails upto 30MB. So I changed the datatype for the column to 'largetext'. Yesterday a mail with size 25 MB was stored. After that whenever I execute mysqldump command it throws error:
mysqldump: Error 2020: Got packet bigger than 'max_allowed_packet' bytes when dumping table `ib_mailbox_backup` at row: 3369
第3369行包含25 MB的邮件.
Row 3369 contains the 25 MB mail.
在MySQL配置中,我将"max_allowed_packet"从64M增加到512M,但仍然失败,并出现相同的错误.在运行MySQL服务器的同一台机器上执行mysqldump命令.我该如何解决?
In MySQL config I increased the 'max_allowed_packet' from 64M to 512M and it still fails with the same error. Executing the mysqldump command on the same machine where MySQL server is running. How do I solve this?
推荐答案
- 您可以在
mysqldump
命令中添加--max_allowed_packet=512M
. - 或将
max_allowed_packet=512M
添加到my.cnf
的[mysqldump]
部分(感谢@Varun)
- You can add
--max_allowed_packet=512M
to yourmysqldump
command. - Or add
max_allowed_packet=512M
to[mysqldump]
section of yourmy.cnf
(thanks @Varun)
注意:如果它不在[mysqldump]
部分下,则将不起作用...
Note: it will not work if it is not under the [mysqldump]
section...
这篇关于mysqldump错误:数据包大于max_allowed_packet'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!