mysql服务无法启动:文件夹损坏

mysql服务无法启动:文件夹损坏

在使用Windows电脑时,突然断电关机可能会导致MySQL服务无法启动。这种情况通常是由于日志文件损坏或不完整所致。本篇文章将介绍如何解决这个问题。

问题原因

突然断电,电脑重启,然后mysql服务就无法启动了

20231205211350397-image

解决方法

打开 mysql目录下的data文件夹,其中有一个以.err结尾的文件就是报错日志

20231205210839992-image

打开他,找到第一次报错的位置

2023-12-04T07:56:21.475383Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2023-12-04T07:56:21.481320Z 0 [System] [MY-010116] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.31) starting as process 10248
2023-12-04T07:56:21.575093Z 0 [Warning] [MY-013907] [InnoDB] Deprecated configuration parameters innodb_log_file_size and/or innodb_log_files_in_group have been used to compute innodb_redo_log_capacity=100663296. Please use innodb_redo_log_capacity instead.
2023-12-04T07:56:21.616614Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.



2023-12-04T07:56:23.296347Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-12-04T07:56:23.928036Z 0 [System] [MY-010229] [Server] Starting XA crash recovery...
2023-12-04T07:56:23.935683Z 0 [System] [MY-010232] [Server] XA crash recovery finished.
2023-12-04T07:56:24.026598Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2023-12-04T07:56:24.027348Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2023-12-04T07:56:24.078194Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060
2023-12-04T07:56:24.078428Z 0 [System] [MY-010931] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: ready for connections. Version: '8.0.31'  socket: ''  port: 3306  MySQL Community Server - GPL.

以上为正常启动时的日志

2023-12-04T09:14:41.757421Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2023-12-04T09:14:41.763284Z 0 [System] [MY-010116] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe (mysqld 8.0.31) starting as process 9736
2023-12-04T09:14:41.830427Z 0 [Warning] [MY-013907] [InnoDB] Deprecated configuration parameters innodb_log_file_size and/or innodb_log_files_in_group have been used to compute innodb_redo_log_capacity=100663296. Please use innodb_redo_log_capacity instead.
2023-12-04T09:14:41.852419Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.

从这里开始日志不一样了,说明这里提示报错信息了

2023-12-04T09:14:42.867848Z 1 [ERROR] [MY-013895] [InnoDB] Found redo log file .\#innodb_redo\#ib_redo11 which has format (v0) and is stored inside #innodb_redo.
2023-12-04T09:14:42.870957Z 1 [ERROR] [MY-012930] [InnoDB] Plugin initialization aborted with error Generic error.
2023-12-04T09:14:42.925448Z 1 [ERROR] [MY-010334] [Server] Failed to initialize DD Storage Engine
2023-12-04T09:14:42.930149Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
2023-12-04T09:14:42.932369Z 0 [ERROR] [MY-010119] [Server] Aborting
2023-12-04T09:14:42.935177Z 0 [System] [MY-010910] [Server] C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld.exe: Shutdown complete (mysqld 8.0.31)  MySQL Community Server - GPL.

通过查看,发现是这两个文件夹有问题

20231205211115390-image

上网查阅后,发现是 #innodb_redo 文件夹损坏,于是借了同学的正常的 #innodb_redo 文件夹替换后,mysql服务就可以重新启动了

20231205211607917-image

THE END
喜欢就支持一下吧
点赞11 分享
Miyan的头像-陌路小站
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容