如何修复 InnoDB 损坏的数据结构?

how to fix InnoDB corrupted data structure?

我删除了 mysql 并安装了 mariadb,我想删除 mysql 会破坏 InnoDB(我是新手)。

InnoDB: Plugin initialization aborted with error Data structure corruption

完整日志:

    -- Subject: Unit mariadb.service has begun start-up
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
-- 
-- Unit mariadb.service has begun starting up.
Jan 16 18:25:55 CentOSVPS1.DylanMediaPC mariadbd[6137]: 2021-01-16 18:25:55 0 [Note] /usr/sbin/mariadbd (mysqld 10.5.8-MariaDB) starting as process 6137 ...
Jan 16 18:25:55 CentOSVPS1.DylanMediaPC mariadbd[6137]: 2021-01-16 18:25:55 0 [Warning] Could not increase number of max_open_files to more than 16384 (request: 32183)
Jan 16 18:25:55 CentOSVPS1.DylanMediaPC mariadbd[6137]: 2021-01-16 18:25:55 0 [Note] InnoDB: Using Linux native AIO
Jan 16 18:25:55 CentOSVPS1.DylanMediaPC mariadbd[6137]: 2021-01-16 18:25:55 0 [Note] InnoDB: Uses event mutexes
Jan 16 18:25:55 CentOSVPS1.DylanMediaPC mariadbd[6137]: 2021-01-16 18:25:55 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
Jan 16 18:25:55 CentOSVPS1.DylanMediaPC mariadbd[6137]: 2021-01-16 18:25:55 0 [Note] InnoDB: Number of pools: 1
Jan 16 18:25:55 CentOSVPS1.DylanMediaPC mariadbd[6137]: 2021-01-16 18:25:55 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
Jan 16 18:25:55 CentOSVPS1.DylanMediaPC mariadbd[6137]: 2021-01-16 18:25:55 0 [Note] mariadbd: O_TMPFILE is not supported on /tmp (disabling future attempts)
Jan 16 18:25:55 CentOSVPS1.DylanMediaPC mariadbd[6137]: 2021-01-16 18:25:55 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
Jan 16 18:25:55 CentOSVPS1.DylanMediaPC mariadbd[6137]: 2021-01-16 18:25:55 0 [Note] InnoDB: Completed initialization of buffer pool
Jan 16 18:25:55 CentOSVPS1.DylanMediaPC mariadbd[6137]: 2021-01-16 18:25:55 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed>
Jan 16 18:25:55 CentOSVPS1.DylanMediaPC mariadbd[6137]: 2021-01-16 18:25:55 0 [ERROR] InnoDB: Invalid flags 0x4800 in ./ibdata1
Jan 16 18:25:55 CentOSVPS1.DylanMediaPC mariadbd[6137]: 2021-01-16 18:25:55 0 [ERROR] InnoDB: Plugin initialization aborted with error Data structure corruption
Jan 16 18:25:55 CentOSVPS1.DylanMediaPC mariadbd[6137]: 2021-01-16 18:25:55 0 [Note] InnoDB: Starting shutdown...
Jan 16 18:25:56 CentOSVPS1.DylanMediaPC mariadbd[6137]: 2021-01-16 18:25:56 0 [ERROR] Plugin 'InnoDB' init function returned error.
Jan 16 18:25:56 CentOSVPS1.DylanMediaPC mariadbd[6137]: 2021-01-16 18:25:56 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
Jan 16 18:25:56 CentOSVPS1.DylanMediaPC mariadbd[6137]: 2021-01-16 18:25:56 0 [Note] Plugin 'FEEDBACK' is disabled.
Jan 16 18:25:56 CentOSVPS1.DylanMediaPC mariadbd[6137]: 2021-01-16 18:25:56 0 [ERROR] Could not open mysql.plugin table: "Table 'mysql.plugin' doesn't exist". Some plugins may be n>
Jan 16 18:25:56 CentOSVPS1.DylanMediaPC mariadbd[6137]: 2021-01-16 18:25:56 0 [ERROR] Unknown/unsupported storage engine: InnoDB
Jan 16 18:25:56 CentOSVPS1.DylanMediaPC mariadbd[6137]: 2021-01-16 18:25:56 0 [ERROR] Aborting
Jan 16 18:25:56 CentOSVPS1.DylanMediaPC systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Jan 16 18:25:56 CentOSVPS1.DylanMediaPC systemd[1]: mariadb.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://access.redhat.com/support

Edit1:根据下面的 post,mysql 和 mariadb 包含了曾经被称为“插件”的 InnoDB 实现。那么我应该重新安装 mariadb 来修复 innodb 吗?

https://dev.mysql.com/doc/refman/5.5/en/innodb-installation.html

When you use the InnoDB storage engine 1.1 and above, with MySQL 5.5 and above, you do not need to do anything special to install: everything comes configured as part of the MySQL source and binary distributions.

Edit2:我在安装 mariadb、删除 mysql 和安装 mysql 时使用了 yum history undo。然后安装了 mariadb。这并没有解决问题,但确实清理了一些未使用的 mysql 依赖项。

Edit3:下面 post 中的以下命令解决了我的问题:

sudo rm -rf /var/lib/mysql/*
sudo mysql_install_db -u mysql

https://dba.stackexchange.com/questions/275885/innodb-failing-to-start-mysql-not-loading-plugins

Edit3:下面 post 中的以下命令解决了我的问题:

sudo rm -rf /var/lib/mysql/*
sudo mysql_install_db -u mysql

https://dba.stackexchange.com/questions/275885/innodb-failing-to-start-mysql-not-loading-plugins

删除 mysql 并安装 mariadb 后,我遇到了同样的问题。在启动 mariadb 之前,我必须删除所有 mysql 个文件:

sudo rm /var/lib/mysql-files /var/lib/mysql-keyring
sudo rm -rf /var/lib/mysql/*