gpt4 book ai didi

MySQL 错误 2006 (HY000) 在第 406 行 : MySQL server has gone away

转载 作者:IT老高 更新时间:2023-10-28 23:51:54 24 4
gpt4 key购买 nike

我有一个来自数据库的 MYSQL 转储,我正试图将其移至新的数据库服务器。当我尝试导入我的 sql 转储时,我收到以下错误:

MySQL Error 2006 (HY000) at line 406: MySQL server has gone away

我用谷歌搜索了这个问题,大多数人通过更改 wait_timeout 的值解决了这个问题。但是,我的当前值设置为 28800(8 小时),运行导入时不到 8 秒就出现错误。

我也尝试将 max_allowed_pa​​cket 的值设置为 1073741824,但这也没有解决问题。

翻阅mysql dump,dump中有不少blob列,但整体文件大小只有6MB。

有人知道还有什么问题吗?

最佳答案

为了将来的搜索者的利益而添加这个答案,因为它解释了为什么增加数据包大小可以解决问题:

The situation is that if a client sends a SQL-statement longer than the server max_allowed_packet setting, the server will simply disconnect the client. Next query from the same client instance will find that the ‘MySQL server has gone away’.

... But it would of course be much preferable to have the ‘got packet bigger’ error [Error: 2020 (CR_NET_PACKET_TOO_LARGE)] returned if that is the problem.

摘自peter_laursen's blog post 并感谢

在 OSX 10.7 (Lion) 上,我创建了一个文件/etc/my.cnf,其内容如下:

[mysqld]
max_allowed_packet = 12000000

然后停止mysql服务器:

/usr/local/bin/mysql.server stop

当它自动重新启动时,我能够执行我的插入操作。

关于MySQL 错误 2006 (HY000) 在第 406 行 : MySQL server has gone away,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8744813/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com