逻辑数据库还原持续导致mysqld服务停止

3pvhb19x  于 2023-06-28  发布在  Mysql
关注(0)|答案(1)|浏览(137)

我在WAMPServer上运行了一个moodle数据库,我正在尝试做一个逻辑备份,并恢复到一个更新的主要版本的WAMPServer上。
逻辑备份的大小是205 MB,当我尝试运行mysql -u root moodle < moodle.sql时,mysqld服务停止(特别是wampmysqld 64服务),我得到错误ERROR 2013 (HY000) at line 625: Lost connection to MySQL server during query(行号可以变化)。
我尝试过将文件分解为较小的块,但成功率有限,但不能保证在重新测试过程时,相同的chink会完成或失败。
我使用的是最新的WAMPServer(3.2.4.8 64位),包含的mysql版本是8.0.31。
我已经尝试了以下更改:

  • 在my.ini配置文件中设置autocommit = 0

我在网上找不到任何关于修复这个问题的信息。
任何建议都欢迎。谢谢

编辑-对评论等进行反馈

1.Service StoppingService definite确实会停止,因为在Services. msc中可以看到它不再运行。我可以手动重新启动。同样,当服务停止时,WAMPServer图标从绿色变为黄色。
1.MySQL Workbench Export所以MySQL Workbench的“内置EXPORT函数”与使用mysqldump或phpMyAdmin的导出函数基本相同。它生成一个SQL文件,其中包含作为导入脚本导出的所有架构和数据对象。这不是导出,我有一个问题-我已经有导出的sql脚本-这是导入失败。
1.超时我尝试将超时时间延长到600秒,但无论如何,错误仅在10-20秒内发生。此外,超时不会导致服务停止,所以我不认为这是一个超时问题。
1.硬件我已经在运行Windows Server 2019的客户端测试虚拟服务器上尝试过这个。我还在我自己的本地虚拟服务器(Hyper-V)上测试了这一点,该服务器运行Windows Server 2022,具有12个vcore和8 GB RAM(全新安装以尝试解决问题)。主机CPU是AMD Ryzen 9 3900 12/24核处理器和32 GB RAM。
1.导出参见https://justpaste.it/ah81y
1.数据恢复期间的此错误有时表示单个查询(可能是长INSERT语句)超过了max_allowed_packet大小这是可能的,尽管它出错的最后一行永远不会相同。max_allowed_packet当前设置为67108864(400 0000 h)= 6.7MB。
当我把完整的sql文件分解成更小的部分(例如2000行)时,有时它会执行,有时服务会停止。例如,现在刚刚运行它,报告的错误是:

CREATE TABLE `mdl_attendance_warning` (
   `id` bigint(10) NOT NULL AUTO_INCREMENT,
   `idnumber` bigint(10) NOT NULL,
   `warningpercent` bigint(10) NOT NULL,
   `warnafter` bigint(10) NOT NULL,
   `maxwarn` bigint(10) NOT NULL DEFAULT '1',
   `emailuser` smallint(4) NOT NULL,
   `emailsubject` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
   `emailcontent` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
   `emailcontentformat` smallint(4) NOT NULL,
   `thirdpartyemails` longtext COLLATE utf8mb4_unicode_ci,
   PRIMARY KEY (`id`),
   UNIQUE KEY `mdl_attewarn_idnwarwar_uix` (`idnumber`,`warningpercent`,`warnafter`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=COMPRESSED COMMENT='Warning configuration'
 
 
 Error Code: 2013. Lost connection to MySQL server during query 0.188 sec

前三个声明是:

DROP TABLE IF EXISTS `mdl_attendance_warning`
    0 row(s) affected   0.016 sec
/*!40101 SET @saved_cs_client     = @@character_set_client */
    0 row(s) affected   0.000 sec
/*!40101 SET character_set_client = utf8 */
    0 row(s) affected, 1 warning(s):
 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.   0.000 sec

1.mysql.log我想我在服务停止之前立即记录了这些错误。以下是三个案例:

2023-06-22T15:54:34.376621Z 0 [ERROR] [MY-012646] [InnoDB] File .\moodle\mdl_auth_oidc_token.ibd: 'aio write' returned OS error 0. Cannot continue operation
2023-06-22T15:54:34.377113Z 0 [ERROR] [MY-012981] [InnoDB] Cannot continue operation.

2023-06-22T15:55:13.587552Z 0 [ERROR] [MY-012646] [InnoDB] File .\moodle\mdl_analytics_models_log.ibd: 'aio write' returned OS error 0. Cannot continue operation
2023-06-22T15:55:13.588131Z 0 [ERROR] [MY-012981] [InnoDB] Cannot continue operation.

2023-06-23T15:36:50.345860Z 0 [ERROR] [MY-012646] [InnoDB] File .\moodle\mdl_assign_user_mapping.ibd: 'aio write' returned OS error 0. Cannot continue operation
2023-06-23T15:36:50.346431Z 0 [ERROR] [MY-012981] [InnoDB] Cannot continue operation.

我将把sql减少到一个可管理的大小,这个大小仍然会导致错误,并且不包含任何敏感数据。也许其他人也会在使用WAMPServer时发生错误?谢谢

k10s72fa

k10s72fa1#

对my.ini [mysqld]部分的建议

max_allowed_packet=1G  # from 64M to tolerate max allowed size
innodb_lru_scan_depth=100  # from 1024 to conserve 90% CPU cycles used for function

停止/启动重试还原,如果仍然失败,

net_read_timeout=300  # from 30 for greater tolerance before timeout
net_write_timeout=300  # from 60 for greater tolerance before timeout
replica_net_timeout=300  # from 60 for greater tolerance before timeout
slave_net_timeout=300  # from 60 for greater tolerance before timeout

复制副本服务器的my.ini将需要相同的超时限制。
如果仍然失败,请考虑在失败后立即发布最后100行错误日志。
请查看个人资料以获取联系信息。
您需要使用OPTIMIZE表名来管理date_free空间超过数据空间10%的碎片表。
这里有一个查询帮助。
SELECT TABLE_SCHEMA,TABLE_NAME,CONCAT(ROUND(data_length /(1024 * 1024),2),'MB')DATA_Space,CONCAT(ROUND(data_free /(1024 * 1024),2),' MB')FREE_Space,create_time,table_rows,engine,create_options
from information_schema.TABLES where TABLE_SCHEMA NOT IN('information_schema','mysql')and Data_free >(DATA_length * .1)ORDER BY FLOOR(FREE_Space)DESC,FLOOR(DATA_Space)DESC,TABLE_SCHEMA,TABLE_NAME LIMIT 0,512;

相关问题