mysql断电后无法启动

1、配置/etc/my.cnf

css 复制代码
innodb_force_recovery=6(这个值越小越安全,最开始建议设置为1,如果也无法启动再改为2,以此内推)

1 (SRV_FORCE_IGNORE_CORRUPT):即使服务器检测到损坏的页仍让它运行。试图使SELECT* FROM tbl_name跳过损坏的索引记录和页,这样有助于转储表。
2 (SRV_FORCE_NO_BACKGROUND):阻止主线程和任何清除线程的运行。如果崩溃会在清除操作中发生,该恢复值会阻止它。
3 (SRV_FORCE_NO_TRX_UNDO):不要在崩溃恢复后运行事务回滚。
4 (SRV_FORCE_NO_IBUF_MERGE):阻止插入缓冲合并操作。如果它们会导致崩溃,不要做这些。不计算表统计。这个值可以永久损坏数据文件。使用这个值后,准备号删除并重建所有辅助索引。在MySQL5.6.15中,设置InnoDB为只读。
5 (SRV_FORCE_NO_UNDO_LOG_SCAN):在启动数据库时不查看撤消日志:InnoDB将即使未完成的事务也作为已提交。这个值可以永久损坏数据文件。在MySQL5.6.15中,设置InnoDB为只读。
6 (SRV_FORCE_NO_LOG_REDO):不要通过恢复对重做日志进行前滚。这个值可能永久损坏数据文件。数据库页被留在一个陈旧的状态,这反过来又可能带给B-trees和其它数据库结构更多的损坏。在MySQL5.6.15中,设置InnoDB为只读。 

2、重启服务

css 复制代码
/etc/init.d/mysql start

3、异常点

css 复制代码
2024-04-12T07:19:50.994404Z mysqld_safe Logging to '/usr/local/mysql/data/mysql.err'.
2024-04-12T07:19:51.048096Z mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
2024-04-12T07:19:51.063416Z 0 [System] [MY-015015] [Server] MySQL Server - start.
2024-04-12T07:19:51.327272Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
2024-04-12T07:19:51.327440Z 0 [System] [MY-010116] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.1.0) starting as process 28354
2024-04-12T07:19:51.340376Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-04-12T07:19:52.829398Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-04-12T07:19:53.028010Z 1 [Warning] [MY-011018] [InnoDB] Skip updating information_schema metadata in InnoDB read-only mode.
2024-04-12T07:19:53.028118Z 1 [Warning] [MY-010005] [Server] Skip re-populating collations and character sets tables in InnoDB read-only mode.
2024-04-12T07:19:53.060142Z 2 [Warning] [MY-011018] [Server] Skip updating information_schema metadata in InnoDB read-only mode.
2024-04-12T07:19:53.061771Z 0 [Warning] [MY-010970] [Server] Skipped updating resource group metadata in InnoDB read only mode.
2024-04-12T07:19:53.061840Z 0 [Warning] [MY-010970] [Server] Skipped updating resource group metadata in InnoDB read only mode.
2024-04-12T07:19:53.238265Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2024-04-12T07:19:53.238343Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2024-04-12T07:19:53.256339Z 0 [ERROR] [MY-000067] [Server] unknown variable 'innodb_purge_thread=0'.
2024-04-12T07:19:53.256463Z 0 [ERROR] [MY-010119] [Server] Aborting
2024-04-12T07:19:53.896663Z 0 [System] [MY-010910] [Server] /usr/local/mysql/bin/mysqld: Shutdown complete (mysqld 8.1.0)  MySQL Community Server - GPL.
2024-04-12T07:19:53.898123Z 0 [System] [MY-015016] [Server] MySQL Server - end.
2024-04-12T07:19:54.069350Z mysqld_safe mysqld from pid file /usr/local/mysql/data/mysql.pid ended

注意error部分,my。cnf配置文件有无法解析的参数,删掉就可以

4、恢复出错文件

相关推荐
g***727010 小时前
从MySQL迁移到PostgreSQL的完整指南
数据库·mysql·postgresql
IT教程资源D10 小时前
[N_129]基于springboot,vue学生宿舍管理系统
mysql·vue·前后端分离·springboot宿舍·宿舍管理系统
冷雨夜中漫步10 小时前
Maven BOM(Bill of Materials)使用指南与常见错误
java·数据库·maven
hanyi_qwe10 小时前
Mysql主从复制与读写分离测试
数据库·mysql
梁bk11 小时前
Redis 通信协议(RESP)
数据库·redis·缓存
思成不止于此11 小时前
MySQL 约束详解:保证数据完整性的核心机制
数据库·笔记·学习·mysql
伐尘11 小时前
【MySQL】windows系统下mysql慢日志查询
windows·mysql·adb
理想三旬11 小时前
数据定义:模式、表、索引
数据库
c***871911 小时前
讲解进阶之路:模块、包和异常处理-上篇
数据库·redis·哈希算法
!chen11 小时前
Oracle分区表+本地索引 核心优化方案
数据库·oracle