今天mysql备份的crontab自动运行的时候,出现了报警,报警内容如下

mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table `file_storage` at row: 29
mysqldump: Couldn't execute 'show table status like 'property'': MySQL server has gone away (2006)
mysqldump: Couldn't execute 'SET OPTION SQL_QUOTE_SHOW_CREATE=1': MySQL server has gone away (2006)
mysqldump: Couldn't execute 'show fields from `property`': MySQL server has gone away (2006)
mysqldump: Couldn't execute 'show table status like 'revision'': MySQL server has gone away (2006)
mysqldump: Couldn't execute 'SET OPTION SQL_QUOTE_SHOW_CREATE=1': MySQL server has gone away (2006)
mysqldump: Couldn't execute 'show fields from `revision`': MySQL server has gone away (2006)
mysqldump: Couldn't execute 'show table status like 'revision\_change'': MySQL server has gone away (2006)
mysqldump: Couldn't execute 'SET OPTION SQL_QUOTE_SHOW_CREATE=1': MySQL server has gone away (2006)
mysqldump: Couldn't execute 'show fields from `revision_change`': MySQL server has gone away (2006)
mysqldump: Couldn't execute 'show table status like 'setting'': MySQL server has gone away (2006)
mysqldump: Couldn't execute 'SET OPTION SQL_QUOTE_SHOW_CREATE=1': MySQL server has gone away (2006)
mysqldump: Couldn't execute 'show fields from `setting`': MySQL server has gone away (2006)
mysqldump: Couldn't execute 'show table status like 'setting\_history'': MySQL server has gone away (2006)
mysqldump: Couldn't execute 'SET OPTION SQL_QUOTE_SHOW_CREATE=1': MySQL server has gone away (2006)
mysqldump: Couldn't execute 'show fields from `setting_history`': MySQL server has gone away (2006)
mysqldump: Couldn't execute 'show table status like 'user'': MySQL server has gone away (2006)
mysqldump: Couldn't execute 'SET OPTION SQL_QUOTE_SHOW_CREATE=1': MySQL server has gone away (2006)
mysqldump: Couldn't execute 'show fields from `user`': MySQL server has gone away (2006)

一开始我把故障的错误点定位在"mysqldump: Couldn't execute 'show fields from `revision`': MySQL server has gone away (2006)"这段报错上面,网上的部分建议是检查max_allowed_packet的值,然后改得尽量大一些,我查看当前的值信息如下:

mysql> show global variables like 'max_allowed_packet';
+--------------------+-----------+
| Variable_name | Value |
+--------------------+-----------+
| max_allowed_packet | 268435456 |
+--------------------+-----------+
1 row in set (0.00 sec)

可以看到当前的值已经是200M了,说明应该不是这个问题导致的,而且查看报错,这里并没有从select获取大量数据,也没有insert或者update大量数据.

我重新运行了一下脚本,过会儿又出现了相同的报错了.

后来注意到有这么一段

mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table `file_storage` at row: 29

在一篇文章里看到了针对这个报错的解决措施

https://ottomatik.groovehq.com/knowledge_base/topics/solving-error-2013-lost-connection-to-mysql-server-during-query-when-dumping-table

后来将timeout的值调大以后,就可以正常dump了

mysql> show global variables like '%timeout%';
+----------------------------+-------+
| Variable_name | Value |
+----------------------------+-------+
| connect_timeout | 10 |
| delayed_insert_timeout | 300 |
| innodb_lock_wait_timeout | 100 |
| innodb_rollback_on_timeout | OFF |
| interactive_timeout | 28800 |
| net_read_timeout | 30 |
| net_write_timeout | 60 |
| slave_net_timeout | 3600 |
| table_lock_wait_timeout | 200 |
| wait_timeout | 28800 |
+----------------------------+-------+
10 rows in set (0.00 sec) mysql> set global net_read_timeout = 120;
Query OK, 0 rows affected (0.03 sec) mysql> set global net_write_timeout = 900;
Query OK, 0 rows affected (0.00 sec) mysql> show global variables like '%timeout%';
+----------------------------+-------+
| Variable_name | Value |
+----------------------------+-------+
| connect_timeout | 10 |
| delayed_insert_timeout | 300 |
| innodb_lock_wait_timeout | 100 |
| innodb_rollback_on_timeout | OFF |
| interactive_timeout | 28800 |
| net_read_timeout | 120 |
| net_write_timeout | 900 |
| slave_net_timeout | 3600 |
| table_lock_wait_timeout | 200 |
| wait_timeout | 28800 |
+----------------------------+-------+
10 rows in set (0.00 sec)

mysqldump导出报错"mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table `file_storage` at row: 29"的更多相关文章

  1. Error NO.2013 Lost connection to Mysql server during query

    系统:[root@hank-yoon ~]# cat /etc/redhat-release CentOS release 6.3 (Final) DB版本:mysql> select @@ve ...

  2. Mysql导入Sql文件时报Error Code: 2013 - Lost connection to MySQL server during query

    MySql 有时我们导入sql文件,文件过大,导致Error Code: 2013 - Lost connection to MySQL server during query这种错误 执行以下: S ...

  3. 问题MySQL Error (2013): Lost connection to MySQL server at waiting for initial communication packet

    错误说明: SQL Error (2013): Lost connection to MySQL server at 'waiting for initial communication packet ...

  4. pymysql.err.OperationalError: (2013, 'Lost connection to MySQL server during query')

    pymysql错误: pymysql.err.OperationalError: (2013, 'Lost connection to MySQL server during query') pymy ...

  5. Procedure execution failed 2013 - Lost connection to MySQL server during query

    1 错误描述 Procedure execution failed 2013 - Lost connection to MySQL server during query 2 错误原因 由错误描述可知 ...

  6. 解决python pymysql.err.OperationalError: (2013, 'Lost connection to MySQL server during query')

    解决python pymysql.err.OperationalError: (2013, 'Lost connection to MySQL server during query') 学习了:ht ...

  7. _mysql_exceptions.OperationalError: (2013, 'Lost connection to MySQL server during query')

    最近写了一个定时脚本,每天凌晨跑,每次跑时间很长. 在测试这个脚本的时候,跑了一个小时,发生一个错误,脚本中断,错误如下: _mysql_exceptions.OperationalError: (2 ...

  8. 2013 lost connection to mysql server during query

    navicat 导入sql大脚本到mysql数据库报错 解决办法: 修改mysql.ini配置文件: max_allowed_packet=256M wait_timeout=5000

  9. navicat mysql报错误:2013 Lost connection to MySQL server during query

    好像是MySQL的navicat UI界面跟数据的连接问题,如果直接用命令导入数据的话,或许能规避这个问题.

随机推荐

  1. pom.xml中build标签

    1.分类 (1)全局配置(project build) 针对整个项目的所有情况都有效 (2)配置(profile build) 针对不同的profile配置 <project xmlns=&qu ...

  2. 网络通信 & 初识socket

    本节主要内容: 1.客户短\服务端架构 2.网络通信的流程 3.初识socket 一.客户端\服务端架构 客户端\服务端架构: 即Client/Server (C/S) 结构,是大家熟知的软件系统体系 ...

  3. phpstorm软件配置端口问题

    phpstorm默认的端口号是:63342 但是我装的apache服务器的默认端口是80 网上查找资料,都说可以加listen的端口,比如这里   #Listen 12.34.56.78:80 Lis ...

  4. 给 layui upload 带每个文件的进度条, .net 后台代码

    1.upload.js 扩展 功能利用ajax的xhr属性实现该功能修改过modules中的upload.js文件功能具体实现:在js文件中添加监听函数 //创建监听函数 var xhrOnProgr ...

  5. 用R创建Word和PowerPoint文档--转载

    https://www.jianshu.com/p/7df62865c3ed Rapp --简书 Microsoft的Office软件在办公软件领域占有绝对的主导地位,几乎每个职场人士都必须掌握Wor ...

  6. SpringMVC 处理Date类型数据@InitBinder @DateTimeFormat 注解 的使用

    使用SpringMVC的时候,需要将表单中的日期字符串转换成对应JavaBean的Date类型,而SpringMVC默认不支持这个格式的转换,解决方法有两种,如下: 方法一 . 在需要日期转换的Con ...

  7. Lua面向对象之二:类继承

    1.类继承 ①代码 Sharp = { } --① 父类 function Sharp:new() local new_sharp = { } self.__index = self --②,self ...

  8. python中函数与函数式编程(一)

    在学习之前,我们先去区分面对对象.面对过程.函数式编程他们之间的区别,从改图可以看出,他们之间不是完全相同的,也不是没有任何相同点的 1.函数和过程的基本认识 def func1(): "& ...

  9. firewalld管理防火墙常用命令

    1.查看防火墙的状态 [root@localhost HMK]# firewall-cmd --state 查看防火墙的运行状态 not running [root@localhost HMK]# s ...

  10. Top 命令解析

    TOP是一个动态显示过程,即可以通过用户按键来不断刷新当前状态.如果在前台执行该命令,它将独占前台,直到用户终止该程序为止.比较准确的说,top命令提供了实时的对系统处理器的状态监视.它将显示系统中C ...