mysql中导入报错-ERROR 2013 (HY000)的案例

【现象】

导入MySQL的mysqldump文件时报错,提示ERROR 2013 (HY000) at line xxoo: Lost connection to MySQL serverduring query,导入操作中断退出。

【原因】

要导入的mysqldump文件中insert的values值太多,超过了MySQL参数max_allowed_packet的值,进而导致导入操作中断退出。

【解决方法】

调高max_allowed_packet的值:

SQL> set global max_allowed_packet=67108864;

【参考资料】

max_allowed_packet值的范围是1024 ..1073741824,单位是字节。

本栏目更多精彩内容:http://www.bianceng.cn/database/MySQL/

The packet message buffer is initialized tonet_buffer_length bytes, but can grow up to max_allowed_packet bytes whenneeded. This value by default is small, to catch large (possibly incorrect)packets.

You must increase this value if you areusing large BLOB columnsor long strings. It should be as big as the largest BLOB you want touse. The protocol limit for max_allowed_packet is 1GB. The value should be amultiple of 1024; nonmultiples are rounded down to the nearest multiple.

Whenyou change the message buffer size by changing the value of themax_allowed_packet variable, you should also change the buffer size on theclient side if your client program permits it. The default max_allowed_packetvalue built in to the client library is 1GB, but individual client programsmight override this. For example, mysql and mysqldump have defaults of 16MB and24MB, respectively. They also enable you to change the client-side value bysetting

【后续】可以测试一下 long strings 和 BLOB column

时间: 2024-10-24 21:23:17

mysql中导入报错-ERROR 2013 (HY000)的案例的相关文章

mysql导入sql文件报错 ERROR 2013 2006 2002

  今天导入sql总是提示错误 代码如下: ERROR 2013 (HY000): Lost connection to MySQL server during query ERROR 2006 (HY000): MySQL server has gone away No connection. Trying to reconnect... ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/l

mysql导入sql文件报错 ERROR 2013 2006 2002_Mysql

今天导入sql总是提示错误 复制代码 代码如下: ERROR 2013 (HY000): Lost connection to MySQL server during query ERROR 2006 (HY000): MySQL server has gone away No connection. Trying to reconnect... ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/va

解决mysql报错ERROR 1201 (HY000):Could not initialize master info structure

在做mysql主从复制时遇到个ERROR 1201 (HY000): Could not initialize master info structure .出现这个问题的原因是之前曾做过主从复制! 解决方案是: 运行命令 stop slave; 成功执行后继续运行 reset slave; 然后重新设置主从复制. 具体过程如下: mysql> change master to master_host='127.0.0.1', master_user='user', master_pass  w

在mac osx10.6下安装mysql后,启动总是报错ERROR 2002 (HY000): Can't connect to local MySQL ser

问题描述 要在mac10.6下安装mysql以便rails开发,装了两天都没有成功.之前没用过mac或linux开发,一直用windows,所以希望高手们能指点一下.我在安装时参考了以下文章:http://beike.iteye.com/blog/617341http://hqman.iteye.com/blog/258979下面是我的安装过程及错误:安装和初始化mysqlport search mysqlsudo port install mysql5-server解决方案二: 解决方案三:

用sqoop把hive中的表格导入到mysql中没有报错但是不成功这是什么问题?在线等,急!

问题描述 c1@u1:~$sqoopexport--connectjdbc:mysql://u1:3306/nihao--usernameroot--passwordhive--tablebujiming--export-dir/Creatingsymlink:/home/c1/hadoop2/tmp/mapred/local/1446172727647/snappy-java-1.0.3.2.jar<-/home/c1/snappy-java-1.-ma15/115/10/2919:38:50

PHP连接MySQL报错:SQLSTATE[HY000] [2002] Can t connect to local

如下所示,PHP连接MySQL报错: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket 'MySQL' (2) 测试代码如下: <?php try {  $dsn = 'mysql:dbname=php-note;host=localhost;port=3306;charset=utf8';  $username = 'root';  $password = 'root';  new PDO( $d

Laravel 5.4中migrate报错: Specified key was too long error的解决

前言 大家都知道,我们经常做项目都团队协作开发,每个人都在自己本地的数据库,如果你曾经出现过让同事手动在数据库结构中添加字段的情况,数据库迁移可以解决你这个问题. 不仅如此,在线上部署的时候,也避免了手动导入数据库或手动修改数据结构的麻烦,数据迁移帮你方便的维护着数据结构. 但方便的同时也会伴随着一些问题,下面这篇文章将详细给大家介绍关于Laravel5.4中migrate报错Specified key was too long error的解决方法,下面话不多说了,来一起看看详细的介绍吧. 发

hql-HQL中使用占位符查询mysql数据老是报错...

问题描述 HQL中使用占位符查询mysql数据老是报错... 执行语句如下: Session session = HibernateUtil.getSession(); String hql = "from Category where name=?"; Query query = session.createQuery(hql); query.setString(0, "饮品"); 错误: ava.lang.NoSuchMethodError: org.hiber

ERROR 2013 (HY000): Lost connection to MySQL server at &amp;#39;waiting for initial communication packet&amp;#39;, system error: 2

ERROR 2013 (HY000): Lost connection to MySQL server at 'waiting for initial communication packet', system error: 2 在/etc/my.cnf[mysqld]中加skip-name-resolve