今天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. 接口Interface的四种含义

    摘自<需求分析与系统设计(第3版)>第七章Q5 1. GUI——显示信息的计算机屏幕(注:其他终端) 2. API——是一套软件程序和开发工具,为应用程序提供函数调用,使程序可以访问一些级 ...

  2. Ubuntu 18.04版本下安装网易云音乐

    这是我迄今为止发现的最完美的解决方法,不用改任何东西,只需要安装然后打开即可,后台也有. 参考:http://archive.ubuntukylin.com:10006/ubuntukylin/poo ...

  3. C# 调用Windows图片查看器

    /// <summary> /// 查看原图 /// </summary> /// <param name="image"></param ...

  4. python中的print()、str()和repr()的区别

    print()函数,我们可以看出,在Python IDLE中直接输入的字符串都是有类型的,而print打印后的字符串相当于一串文字,把字符串的引号也省略了,没有类型 print()函数,生成可读性更好 ...

  5. Python—合并两个有序列表

    def hb(list1,list2): result = [] while list1 and list2: ] < list2[]: result.append(list1[]) del l ...

  6. 1.1 vue.js devtools使用教程

    1. vue.js devtools使用教程

  7. 自定义 Git - 配置 Git

    用git config配置 Git,要做的第一件事就是设置名字和邮箱地址: $ git config --global user.name "John Doe" $ git con ...

  8. 使用JDBC从数据库中查询数据的方法

    * ResultSet 结果集:封装了使用JDBC 进行查询的结果 * 1. 调用Statement 对象的 executeQuery(sql) 方法可以得到结果集 * 2. ResultSet 返回 ...

  9. 关于js函数,方法,对象实例的一些说明

    朋友们大家好,好久没有更新文章了,最近正好有空就想着写点什么吧,加上这段时间总是能听到一些朋友们问关于js函数,方法,对象实例到底有什么区别这个问题,所以今天就献丑来简单说明一些吧! 其实这些主要都是 ...

  10. web前端名人的博客微博Githu

    尤雨溪 vuejs作者 王垠  http://www.yinwang.org/ 20位活跃在Github上的国内技术大牛  1. lifesinger(玉伯)  Github主页:        ht ...