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、恢复出错文件

相关推荐
执笔诉情殇〆12 分钟前
springboot集成达梦数据库,取消MySQL数据库,解决问题和冲突
数据库·spring boot·mysql·达梦
软件技术NINI1 小时前
springMvc的简单使用:要求在浏览器发起请求,由springMVC接受请求并响应,将个人简历信息展示到浏览器
数据库·mysql
SailingCoder2 小时前
MongoDB Memory Server与完整的MongoDB的主要区别
数据库·mongodb
水木石画室2 小时前
MongoDB 常用增删改查方法及示例
数据库·mongodb
旷世奇才李先生2 小时前
MongoDB 安装使用教程
数据库·mongodb
qq_339282232 小时前
mongodb 中dbs 时,local代表的是什么
数据库·mongodb
阿里云大数据AI技术3 小时前
AI搜索 MCP最佳实践
数据库·人工智能·搜索引擎
笑衬人心。3 小时前
项目中数据库表设计规范与实践(含案例)
服务器·数据库·设计规范
cpsvps3 小时前
触发器设计美国VPS:优化数据库性能的关键策略
数据库·oracle
s153353 小时前
数据结构之顺序表,链表,栈,队列
数据结构·数据库