description:
remember that your MySQL "max_allowed_packet" configuration setting (default 1MB)
mysql 默认最大能够处理的是1MB
如果你在sql使用了大的text或者BLOB数据,就会出现这个问题。 php手册上的注释
When trying to INSERT or UPDATE and trying to put a large amount of text or data (blob) into a mysql table you might run into problems.
In mysql.err you might see:
Packet too large (73904)
To fix you just have to start up mysql with the option -O max_allowed_packet=maxsize
You would just replace maxsize with the max size you want to insert, the default is 65536
mysql手册上说
Both the client and the server have their own max_allowed_packet variable, so if you want to handle big packets, you must increase this variable both in the client and in the server.
If you are using the mysql client program, its default max_allowed_packet variable is 16MB. To set a larger value, start mysql like this:
shell> mysql --max_allowed_packet=32M That sets the packet size to 32MB.
The server's default max_allowed_packet value is 1MB. You can increase this if the server needs to handle big queries (for example, if you are working with big BLOB columns). For example, to set the variable to 16MB, start the server like this:
shell> mysqld --max_allowed_packet=16M You can also use an option file to set max_allowed_packet. For example, to set the size for the server to 16MB, add the following lines in an option file:
[mysqld]max_allowed_packet=16M
使用mysql做数据库还原的时候,由于有些数据很大,会出现这样的错误:The MySQL Server returned this Error:MySQL Error Nr.2006-MySQL server has gone away。我的一个150mb的备份还原的时候就出现了这错误。解决的方法就是找到mysql安装目录,找到my.ini文件,在文件的最后添加:max_allowed_packet = 10M(也可以设置自己需要的大小)。 max_allowed_packet 参数的作用是,用来控制其通信缓冲区的最大长度。
分享到:
相关推荐
其次,超时问题也是导致MySQL Server has gone away错误的常见原因。MySQL服务器有两组超时设置,`wait_timeout`和`interactive_timeout`。前者针对非交互式连接(如Web应用),后者针对交互式连接(如命令行客户端...
MySQL导入sql脚本错误:2006 – MySQL server has gone away 到如一些小脚本很少报错,但最近导入一个10+M的SQL脚本,却重复报错: Error occured at:2014-03-24 11:42:24 Line no.:85 Error Code: 2006 - MySQL ...
在我们使用mysql导入大文件sql时可能会报MySQL server has gone away错误,该问题是max_allowed_packet配置的默认值设置太小,只需要相应调大该项的值之后再次导入便能成功。该项的作用是限制mysql服务端接收到的包...
在 Gearman 中,worker 运行在常驻后台模式,可能会遇到一个问题,即与 MySQL 数据库的连接在处理任务过程中因“MySQL server has gone away”而中断。这通常是由于多种原因造成的,包括 MySQL 服务宕机、超时、请求...
在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: 命名管道提供程序, error: 40 - 无法打开到 ...
MYSQL server has gone away 引起这个原因是不可怕的.原因是更改了系统的断开时间. mysql>show gloable variables like “%timeout%”; 进行查看 interactive_timeout 的黓认值为28800 wait_timeout 的默认值这:...
在IT领域,尤其是在数据库管理与优化方面,对MySQL进行精细调节和优化是提升系统性能、保障数据处理效率的关键。以下是对“101个MySQL的调节和优化方法”这一主题的深入解析,涵盖从硬件配置到软件参数设置,以及...
若导入时报错,ERROR 2006 (HY000):MySQL server has gone away 。我们可以通过语句查看一下允许的最大包大小:show global variables like 'max_allowed_packet'; MySQL使用最大数据包站站点进行服务器和客户端...
Qt5.4下连接Mysql,QSqlDatabase: QMYSQL driver not loaded but available-附件资源
本文将详细讨论两个常见的错误:“MySQL server has gone away”和“Can't connect to [local] MySQL server”。 首先,让我们关注“MySQL server has gone away”错误。这个错误通常意味着服务器在执行查询时超时...
OperationalError: (2006, ‘MySQL server has gone away’) OperationalError: (2013, ‘Lost connection to MySQL server during query’) 查询mysql全局变量SHOW GLOBAL VARIABLES;可以看到wait_timeout,此变量...
基于tp5的swoole支持,对th5的connection进行改造,使用Swoole\Coroutine\MySQL重写了基于swoole的PDO接口,实现了mysql的数据库连接池,本地测试可用。使用时,替换thinkphp/library/think/db/Connection.php,并...