簡體   English   中英

docker 中的 MariaDB 說 - 錯誤代碼:2013。在查詢期間失去與 MySQL 服務器的連接

[英]MariaDB in docker said - Error Code: 2013. Lost connection to MySQL server during query

我開始 mariadb docker 有許多重要的選項

--connect_timeout  43200 --max_allowed_packet 1073741824 --net_read_timeout 100 --innodb_buffer_pool_size 64M

我也增加了我的 wokrbench 的超時時間

在此處輸入圖像描述

但是經過大量實驗后,我仍然收到丟失的連接。

下面我放置我的 SQL 命令產生錯誤。 這是另一個工作 mariadb 服務器的轉儲,但沒有 docker。

DROP TABLE IF EXISTS `AspNetUsers`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `AspNetUsers` (
  `Id` varchar(255) CHARACTER SET utf8mb4 NOT NULL,
  `UserName` varchar(256) CHARACTER SET utf8mb4 DEFAULT NULL,
  `NormalizedUserName` varchar(256) CHARACTER SET utf8mb4 DEFAULT NULL,
  `Email` varchar(256) CHARACTER SET utf8mb4 DEFAULT NULL,
  `NormalizedEmail` varchar(256) CHARACTER SET utf8mb4 DEFAULT NULL,
  `EmailConfirmed` tinyint(1) NOT NULL,
  `PasswordHash` longtext CHARACTER SET utf8mb4 DEFAULT NULL,
  `SecurityStamp` longtext CHARACTER SET utf8mb4 DEFAULT NULL,
  `ConcurrencyStamp` longtext CHARACTER SET utf8mb4 DEFAULT NULL,
  `PhoneNumber` longtext CHARACTER SET utf8mb4 DEFAULT NULL,
  `PhoneNumberConfirmed` tinyint(1) NOT NULL,
  `TwoFactorEnabled` tinyint(1) NOT NULL,
  `LockoutEnd` datetime(6) DEFAULT NULL,
  `LockoutEnabled` tinyint(1) NOT NULL,
  `AccessFailedCount` int(11) NOT NULL,
  `DiscordId` longtext CHARACTER SET utf8mb4 DEFAULT NULL,
  `DiscordEnabled` tinyint(1) NOT NULL,
  `DiscordServerId` longtext CHARACTER SET utf8mb4 DEFAULT NULL,
  `IsGoogleAuthenticatorEnabled` tinyint(1) NOT NULL,
  `GoogleAuthenticatorSecretKey` longtext CHARACTER SET utf8mb4 DEFAULT NULL,
  `IPAddress` longtext CHARACTER SET utf8mb4 DEFAULT NULL,
  `UserAgent` longtext CHARACTER SET utf8mb4 DEFAULT NULL,
  `ResetDone` tinyint(1) NOT NULL,
  `APIKey` char(36) COLLATE utf8_bin NOT NULL,
  PRIMARY KEY (`Id`),
  UNIQUE KEY `UserNameIndex` (`NormalizedUserName`),
  KEY `EmailIndex` (`NormalizedEmail`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;

這是容器的日志

2020-12-04  1:49:02 0 [Note] mysqld: O_TMPFILE is not supported on /tmp (disabling future attempts)
2020-12-04  1:49:02 0 [Note] InnoDB: Initializing buffer pool, total size = 67108864, chunk size = 67108864
2020-12-04  1:49:02 0 [Note] InnoDB: Completed initialization of buffer pool
2020-12-04  1:49:02 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-12-04  1:49:02 0 [Note] InnoDB: 128 rollback segments are active.
2020-12-04  1:49:02 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-12-04  1:49:02 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-12-04  1:49:02 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-12-04  1:49:02 0 [Note] InnoDB: 10.5.8 started; log sequence number 67060; transaction id 71
2020-12-04  1:49:02 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2020-12-04  1:49:02 0 [Note] Plugin 'FEEDBACK' is disabled.
2020-12-04  1:49:02 0 [Note] InnoDB: Buffer pool(s) load completed at 201204  1:49:02
2020-12-04  1:49:02 0 [Note] Server socket created on IP: '::'.
2020-12-04  1:49:02 0 [Warning] 'proxies_priv' entry '@% root@f29788dfc1fd' ignored in --skip-name-resolve mode.
2020-12-04  1:49:02 0 [Note] Reading of all Master_info entries succeeded
2020-12-04  1:49:02 0 [Note] Added new Master_info '' to hash table
2020-12-04  1:49:02 0 [Note] mysqld: ready for connections.
Version: '10.5.8-MariaDB-1:10.5.8+maria~focal'  socket: '/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution
2020-12-04  4:00:53 4 [Warning] Aborted connection 4 to db: 'YYYYYYY' user: 'root' host: 'XX.XX.XX.XX' (Got timeout reading communication packets)

有人了解會發生什么嗎?

我找到了另一個解決方案來運行 SQL 腳本在 dockerizing mariadb 服務器。 我在同一台機器的命令行中運行相同的腳本:

sudo docker exec -i mariadb-server2 sh -c 'exec mysql -uroot -p"xxxxxxxx"' < /home/wwwadmin/tst1.sql

為什么這個腳本不能通過 docker 網絡和 Workbench 遠程工作我仍然不明白。 有趣的是,我需要上傳一個包含大量表和數據的大型數據庫,但只有幾個腳本會引發此錯誤“錯誤代碼:2013。在查詢期間丟失與 MySQL 服務器的連接”。 99.9% 的 sql 腳本運行時沒有此錯誤。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM