Home > Database > Mysql Tutorial > MySQL导入数据提示max_allowed_packet错误的解决方法_MySQL

MySQL导入数据提示max_allowed_packet错误的解决方法_MySQL

WBOY
Release: 2016-06-01 13:29:33
Original
1142 people have browsed it

bitsCN.com

MySQL导入数据提示max_allowed_packet错误的解决方法

 

Mysql 5.1 遇到的信息包过大问题 用客户端导入数据的时候,遇到 错误代码: 1153 – Got a packet bigger than ‘max_allowed_packet’ bytes 终止了数据导入。 

 

当MySQL客户端或mysqld服务器收到大于max_allowed_packet字节的信息包时,将发出“信息包过大”错误,并关闭连接。对于某些客户端,如果通信信息包过大,在执行查询期间,可能会遇到“丢失与MySQL服务器的连接”错误。 

 

客户端和服务器均有自己的max_allowed_packet变量,因此,如你打算处理大的信息包,必须增加客户端和服务器上的该变量。一般情况下,服务器默认max-allowed-packet为1MB。 

 

如果你正在使用mysql客户端程序,其max_allowed_packet变量的默认值为16MB。要想设置较大的值,可用下述方式启动mysql 

 

mysql>mysql –max-allowed-packet=32M 
Copy after login

 

 

在my.ini也可以更改,需要重新启动mysql 

 

在my.ini加入[mysqld]max_allowed_packet=16M 

 

bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template