InnoDB导致MySQL无法重启

Vie*_* Vu 5 mysql innodb windows-subsystem-for-linux

我无法重新启动 MySQL 或从(InnoDB 表)恢复 MySQL

  • 我有一个使用 Ubuntu 16.04 的 WSL。由于“未知”的意外,早上我无法访问 MySQL。尝试重新启动它......所有错误。尝试了有关 InnoDB 和日志* 文件的所有建议。但没有成功。我备份了 /var/lib/mysql 并重新安装了 WSL 的新实例 - Ubuntu 16.04

  • 尝试从物理备份文件(日志*&数据文件&数据库目录)恢复。但仍然有同样的错误。

[更新1]

请遵循本指南:https://dba.stackexchange.com/questions/71596/restoring-mysql-tables-from-ibd-frm-and-mysqllogbin-files

  • 我重新安装了另一个 WSL
  • 按照指南从 .frm 和 .idb 恢复数据库
  • 一切都很顺利,直到导入表空间。MySQL 一直说: ERROR 1812 (HY000): Tablespace is missing for table `dbname`.`table`
2019-05-16T03:04:36.061132Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2019-05-16T03:04:36.207628Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2019-05-16T03:04:36.208347Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2019-05-16T03:04:36.472045Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-05-16T03:04:36.481592Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.26-0ubuntu0.16.04.1) starting as process 15703 ...
2019-05-16T03:04:36.503219Z 0 [Note] InnoDB: PUNCH HOLE support available
2019-05-16T03:04:36.503655Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-05-16T03:04:36.503712Z 0 [Note] InnoDB: Uses event mutexes
2019-05-16T03:04:36.503749Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2019-05-16T03:04:36.503783Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2019-05-16T03:04:36.503823Z 0 [Note] InnoDB: Using Linux native AIO
2019-05-16T03:04:36.504677Z 0 [Note] InnoDB: Number of pools: 1
2019-05-16T03:04:36.505431Z 0 [Note] InnoDB: Using CPU crc32 instructions
2019-05-16T03:04:36.521629Z 0 [ERROR] InnoDB: Linux Native AIO interface is not supported on this platform. Please check your OS documentation and install appropriate binary of InnoDB.
2019-05-16T03:04:36.521855Z 0 [Note] InnoDB: You can disable Linux Native AIO by setting innodb_use_native_aio = 0 in my.cnf
2019-05-16T03:04:36.521899Z 0 [Warning] InnoDB: Linux Native AIO disabled.
2019-05-16T03:04:36.525155Z 0 [Note] InnoDB: Initializing buffer pool, total size = 4G, instances = 8, chunk size = 128M
2019-05-16T03:04:37.245621Z 0 [Note] InnoDB: Completed initialization of buffer pool
2019-05-16T03:04:37.452784Z 0 [Note] InnoDB: page_cleaner coordinator priority: -20
2019-05-16T03:04:37.453044Z 0 [Note] InnoDB: page_cleaner worker priority: -20
2019-05-16T03:04:37.453378Z 0 [Note] InnoDB: page_cleaner worker priority: -20
2019-05-16T03:04:37.453477Z 0 [Note] InnoDB: page_cleaner worker priority: -20
2019-05-16T03:04:37.461387Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2019-05-16T03:04:37.587188Z 0 [ERROR] InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 22709914082 and the end 22709914054.
2019-05-16T03:04:37.587391Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2019-05-16T03:04:37.890878Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2019-05-16T03:04:37.891081Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2019-05-16T03:04:37.891128Z 0 [ERROR] Failed to initialize builtin plugins.
2019-05-16T03:04:37.891164Z 0 [ERROR] Aborting

2019-05-16T03:04:37.891207Z 0 [Note] Binlog end
2019-05-16T03:04:37.891332Z 0 [Note] Shutting down plugin 'CSV'
2019-05-16T03:04:37.891962Z 0 [Note] /usr/sbin/mysqld: Shutdown complete

2019-05-16T03:04:37.959132Z mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended ````

Run Code Online (Sandbox Code Playgroud)

Fel*_*too 4

对于[错误] InnoDB:此平台不支持 Linux Native AIO 接口。请检查您的操作系统文档并安装适当的 InnoDB 二进制文件。
解决方案:在/etc/mysql/my.cnf
添加以下行

[mysqld]
innodb_use_native_aio = 0
Run Code Online (Sandbox Code Playgroud)

对于[ERROR] InnoDB: Ignoring the redo log due to Missing MLOG_CHECKPOINT between the checkpoint 92858715 and the end 92858687.
解决方案:从/var/lib/mysql
中删除 ib_logfiles

sudo rm -rf /var/lib/mysql/ib_logfile*
Run Code Online (Sandbox Code Playgroud)

  • InnoDB重做日志(预写日志)的存在只有一个目的:保证自最新日志检查点以来已修改的数据文件的更改的持久性。如果您删除日志文件(或使用“innodb_force_recovery = 6”)作为此类问题的“修复”,您可能最终会得到一个数据库,其中对某些数据页的更新被丢弃。例如,如果索引页被拆分并且仅写入了某些涉及的页,则索引将被损坏。这样的建议激励我实施 https://jira.mariadb.org/browse/MDEV-27199 (2认同)