我如何将 innodb-files 恢复为 sql 文件?

我如何将 innodb-files 恢复为 sql 文件?

我正在尝试从文件恢复 innodb 数据库。我关注

  1. 在我的 services.msc 上停止 mysql 守护进程/服务(# services stop mysql)并确保 MySql 服务没有运行。
  2. 用备份目录替换新的“数据”目录(不要忘记使用备份的副本,而不是使用唯一的备份!!)
  3. 使用 innodb revocery 参数启动 mysqld,并保持窗口打开:mysqld --standalone --console --innodb-force-recovery=4。控制台将保持打开状态,您将直接在屏幕上看到日志消息(CTRL-C 将关闭服务器),我遇到了许多问题,请参见第 7 步之后我已从恢复中复制并粘贴了输出。

最后进入了sudo -u mysql mysqld --standalone --console --explicit_defaults_for_timestamp --innodb-force-recovery=4,我得到了

2016-10-21T04:56:01.469769Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2016-10-21T04:56:01.469808Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2016-10-21T04:56:01.608783Z 0 [Note] mysqld (mysqld 5.7.15-0ubuntu2) starting as process 21945 ...
2016-10-21T04:56:01.611402Z 0 [Note] InnoDB: PUNCH HOLE support available
2016-10-21T04:56:01.611455Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-10-21T04:56:01.611514Z 0 [Note] InnoDB: Uses event mutexes
2016-10-21T04:56:01.611551Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2016-10-21T04:56:01.611586Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2016-10-21T04:56:01.611620Z 0 [Note] InnoDB: Using Linux native AIO
2016-10-21T04:56:01.611798Z 0 [Note] InnoDB: Number of pools: 1
2016-10-21T04:56:01.611903Z 0 [Note] InnoDB: Using CPU crc32 instructions
2016-10-21T04:56:01.612745Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2016-10-21T04:56:01.617639Z 0 [Note] InnoDB: Completed initialization of buffer pool
2016-10-21T04:56:01.618798Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2016-10-21T04:56:01.630251Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2016-10-21T04:56:01.630414Z 0 [ERROR] InnoDB: Upgrade after a crash is not supported. This redo log was created before MySQL 5.7.9, and it appears corrupted. Please follow the instructions at http://dev.mysql.com/doc/refman/5.7/en/upgrading.html
2016-10-21T04:56:01.630461Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2016-10-21T04:56:02.232149Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2016-10-21T04:56:02.232182Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2016-10-21T04:56:02.232190Z 0 [ERROR] Failed to initialize plugins.
2016-10-21T04:56:02.232195Z 0 [ERROR] Aborting

2016-10-21T04:56:02.232201Z 0 [Note] Binlog end
2016-10-21T04:56:02.232251Z 0 [Note] Shutting down plugin 'CSV'
2016-10-21T04:56:02.232586Z 0 [Note] mysqld: Shutdown complete

但我不想升级,只想将文件还原为 sql 文件。我怎样才能将文件还原为 sql 文件呢?

编辑:--innodb-force-recovery=6解决了,多么直观。

相关内容