mysqldump导出报错"mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table `file_storage` at row: 29"

今天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)
时间: 2024-10-12 02:30:40

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

Error NO.2013 Lost connection to Mysql server during query

系统:[[email protected] ~]# cat /etc/redhat-release CentOS release 6.3 (Final) DB版本:mysql> select @@version;+------------+| @@version  |+------------+| 5.6.26-log |+------------+ 数据中心部门申请线上数据库select权限,直接grant  select on DB.* to 'username'@'IP' identifi

解决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', system error: 0 [错产生经过]:链接MySQL时出现. [解决办法]:打开my.ini,找到[mysqld]项,在其后加入一句:skip-name-resolve,保存,重启mysql服务即可~

Error Code: 2013. Lost connection to MySQL server during query

问题情境: 从开发机导出MySQL数据库的schema,然后导入测试机的MySQL数据库,出现错误消息:Error Code: 2013. Lost connection to MySQL server during query. 完整的错误消息: 10:38:35??? CREATE TABLE `__migrationhistory` (?? `MigrationId` varchar(150) NOT NULL,?? `ContextKey` varchar(300) NOT NULL,?

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

MySql 有时我们导入sql文件,文件过大,导致Error Code: 2013 - Lost connection to MySQL server during query这种错误 执行以下: [sql] view plain copy print? SHOW GLOBAL VARIABLES LIKE '%timeout'; SET GLOBAL net_write_timeout=28800; SET GLOBAL net_read_timeout=100; SET GLOBAL con

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

1 错误描述 Procedure execution failed 2013 - Lost connection to MySQL server during query 2 错误原因 由错误描述可知,是在查询的过程中,数据库失去连接 3 解决办法 重新连接数据库

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

最近写了一个定时脚本,每天凌晨跑,每次跑时间很长. 在测试这个脚本的时候,跑了一个小时,发生一个错误,脚本中断,错误如下: _mysql_exceptions.OperationalError: (2013, 'Lost connection to MySQL server during query') 查阅资料,请教同事,最后得出结论: 因为mysql有一个默认的connect_timeout时间,一旦超过,会自动关闭连接. 可以尝试以下两种方式: 创建连接时制定connect_timeout

2013 lost connection to mysql server during query

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

错误代码: 2013 Lost connection to MySQL server during query

安装好mysql服务器,只要心建表,mysql服务就停止,网上各种搜索,查看错误日志文件J7QOUPHFF0VDD2O.err 2015-05-26 10:50:51 1160 InnoDB: Operating system error number 6 in a file operation. InnoDB: Some operating system error numbers are described at InnoDB: http://dev.mysql.com/doc/refman

MySQL中查询时"Lost connection to MySQL server during query"报错的解决方案

一.问题描述: mysql数据库查询时,遇到下面的报错信息: 二.原因分析: dw_user 表数据量比较大,直接查询速度慢,容易"卡死",导致数据库自动连接超时.... 三.解决办法: 方案1.在mysql配置文件[myslqd]下面添加一行设置skip-name-resolve.需要重启mysql服务. 方案2.在hosts文件内添加: ip与主机名的映射关系[这种方式不用重启] 如: 在hosts文件中添加: 127.0.0.1 localhost 其他网上的方法: 1. 代码层