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

相关推荐
TDengine (老段)27 分钟前
TDengine 字符串函数 CHAR 用户手册
java·大数据·数据库·物联网·时序数据库·tdengine·涛思数据
qq74223498438 分钟前
Python操作数据库之pyodbc
开发语言·数据库·python
姚远Oracle ACE1 小时前
Oracle 如何计算 AWR 报告中的 Sessions 数量
数据库·oracle
Dxy12393102162 小时前
MySQL的SUBSTRING函数详解与应用
数据库·mysql
码力引擎2 小时前
【零基础学MySQL】第十二章:DCL详解
数据库·mysql·1024程序员节
杨云龙UP2 小时前
【MySQL迁移】MySQL数据库迁移实战(利用mysqldump从Windows 5.7迁至Linux 8.0)
linux·运维·数据库·mysql·mssql
l1t2 小时前
利用DeepSeek辅助修改luadbi-duckdb读取DuckDB decimal数据类型
c语言·数据库·单元测试·lua·duckdb
安当加密2 小时前
Nacos配置安全治理:把数据库密码从YAML里请出去
数据库·安全
ColderYY3 小时前
Python连接MySQL数据库
数据库·python·mysql
IT教程资源C3 小时前
(N_084)基于jsp,ssm学生信息管理系统
mysql·jsp·ssm学生信息