![](/img/trans.png)
[英]MySQL ERROR 2013 (HY000): Lost connection to MySQL server during query
[英]ERROR 2013 (HY000): Lost connection to MySQL during query
I have a remote MySQL database, and my deployed application (a few java microservice applications) consistently encounters the error ERROR 2013 (HY000): Lost connection to MySQL during query
with some SQL queries. 然后我嘗試使用 MySQL 命令行客戶端連接到 mysql,執行相同的查詢,並設法復制相同的錯誤。 Below is Mysql setup after following this page https://dev.mysql.com/doc/refman/5.7/en/error-lost-connection.html
+------------------------------+----------+
| Variable_name | Value |
+------------------------------+----------+
| connect_timeout | 3600 |
| delayed_insert_timeout | 300 |
| have_statement_timeout | YES |
| innodb_flush_log_at_timeout | 1 |
| innodb_lock_wait_timeout | 5 |
| innodb_rollback_on_timeout | OFF |
| interactive_timeout | 7200 |
| lock_wait_timeout | 50 |
| net_read_timeout | 3000 |
| net_write_timeout | 6000 |
| rpl_semi_sync_master_timeout | 10000 |
| rpl_stop_slave_timeout | 31536000 |
| slave_net_timeout | 4 |
| wait_timeout | 7200 |
+------------------------------+----------+
+--------------------------+------------+
| Variable_name | Value |
+--------------------------+------------+
| max_allowed_packet | 1073741824 |
| slave_max_allowed_packet | 1073741824 |
+--------------------------+------------+
但是,在從 mysql 命令行客戶端執行大 SQL 查詢后大約 10 分鍾后,我系統地遇到了同樣的錯誤。
注意:在 DB 服務器端,我注意到日志 [Note] Aborted connection xxxxx to db: 'xxxxx' user 'xxxxx' host 'xxxxx' (Got an error writing communication packet)
DBA 在安裝了 mysql 的服務器上成功執行了查詢。 但是我們必須遠程使用 mysql 作為服務。
如果有人可以提供幫助,我將不勝感激。
最后,根本原因是網絡問題。 我們的遠程 MySQL 實例作為服務公開。 客戶端和 MySQL DB 之間有一個額外的代理。 默認情況下,如果客戶端和服務器之間超過 10 分鍾沒有通信,連接將被關閉。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.