系统崩溃后 MySQL 损坏

系统崩溃后 MySQL 损坏

我正在使用 MacOS Monterey 12.6.1、Homebrew 3.6.6 和 MariaDB 10.8.3

操作系统突然崩溃并自行重启。重启后,我无法连接到数据库:无法通过套接字“/tmp/mysql.sock”连接到本地 MySQL 服务器 (2)

“mysqld”命令的当前结果:

[Note] mysqld (server 10.8.3-MariaDB) starting as process 12300 ...
[Warning] Setting lower_case_table_names=2 because file system for /opt/homebrew/var/mysql/ is case 
[Note] InnoDB: Compressed tables use zlib 1.2.11
[Note] InnoDB: Number of transaction pools: 1
[Note] InnoDB: Using generic crc32 instructions
[Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
[Note] InnoDB: Completed initialization of buffer pool
[ERROR] InnoDB: Upgrade after a crash is not supported. The redo log was created with MariaDB 
[ERROR] InnoDB: Plugin initialization aborted with error Generic error
[Note] InnoDB: Starting shutdown...
[ERROR] Plugin 'InnoDB' init function returned error.
[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
[Note] Plugin 'FEEDBACK' is disabled.
[ERROR] Unknown/unsupported storage engine: InnoDB
[ERROR] Aborting

错误日志如下:

mysqld_safe mysqld from pid file /opt/homebrew/var/mysql/crtx.pid ended
mysqld_safe Starting mariadbd daemon with databases from /opt/homebrew/var/mysql
[Note] /opt/homebrew/Cellar/mariadb/10.8.3_1/bin/mariadbd (server 10.8.3-MariaDB) starting as process 9036 ...
[Warning] Setting lower_case_table_names=2 because file system for /opt/homebrew/var/mysql/ is case insensitive
[Note] InnoDB: !!! innodb_force_recovery is set to 1 !!!
[Note] InnoDB: Compressed tables use zlib 1.2.11
[Note] InnoDB: Number of transaction pools: 1
[Note] InnoDB: Using generic crc32 instructions
[Note] InnoDB: Initializing buffer pool, total size = 128.000MiB, chunk size = 2.000MiB
[Note] InnoDB: Completed initialization of buffer pool
[ERROR] InnoDB: File ./ib_logfile0 was not found
[ERROR] InnoDB: Plugin initialization aborted with error Generic error
[Note] InnoDB: Starting shutdown...
[ERROR] Plugin 'InnoDB' init function returned error.
[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
[Note] Plugin 'FEEDBACK' is disabled.
[ERROR] Unknown/unsupported storage engine: InnoDB
[ERROR] Aborting

我通过 Homebrew 升级到了新版 MariaDB,但由于版本已损坏,因此无法使用。据我所知,现在无法再降级到原始版本。

我尝试了删除ib_logfile*的方法,但是没有效果,尝试在my.cnf中设置“innodb_force_recovery=1/2/3”参数来修复,结果还是不行。

我有 1 个月的工作,但没有最新的备份。

有什么方法可以修复服务器并使其重新运行吗?

或者至少恢复内部数据库?这样我就可以进行全新安装并再次创建表...

答案1

你应该能够

brew uninstall mariadb
brew install [email protected]

这将安装旧版本,但保留您的数据库。然后“不支持崩溃后升级”错误应该会消失。

相关内容