Innodb

從 Windows 10 中 XAMP 中備份的“數據”文件夾中恢復 InnoDB 數據庫

  • June 11, 2021

我從 mysql 文件夾中複製了數據目錄並解除安裝了 XAMPP,因為 MariaDB 沒有啟動。我安裝了 XAMPP 相同版本並將數據文件夾備份到 mysql 數據目錄中。起初只複製了mysql數據目錄中所需的名為**production的數據庫文件夾。**儘管沒有記錄/行,但 PhpMyAdmin 正確顯示了表格,並且顯示“引擎中不存在表格”。然後我將DATA文件夾中的所有內容複製到mysql數據文件夾中,現在它沒有啟動。現在的問題是 MariaDB 沒有啟動。我嘗試設置 innodb_force_recovery但無法啟動 mysql。

錯誤日誌如下:

2021-06-11  0:08:23 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2021-06-11  0:08:23 0 [Note] InnoDB: Uses event mutexes
2021-06-11  0:08:23 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-06-11  0:08:23 0 [Note] InnoDB: Number of pools: 1
2021-06-11  0:08:23 0 [Note] InnoDB: Using SSE2 crc32 instructions
2021-06-11  0:08:23 0 [Note] InnoDB: Initializing buffer pool, total size = 16M, instances = 1, chunk size = 16M
2021-06-11  0:08:23 0 [Note] InnoDB: Completed initialization of buffer pool
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11  0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11  0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\applied.ibd' OS error: 203
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11  0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11  0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for ``jobs`.`applied``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11  0:08:23 0 [Warning] InnoDB: Ignoring tablespace for `jobs`.`applied` because it could not be opened.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11  0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11  0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\data.ibd' OS error: 203
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11  0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11  0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for ``jobs`.`data``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11  0:08:23 0 [Warning] InnoDB: Ignoring tablespace for `jobs`.`data` because it could not be opened.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11  0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11  0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\data_employer.ibd' OS error: 203
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11  0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11  0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for ``jobs`.`data_employer``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11  0:08:23 0 [Warning] InnoDB: Ignoring tablespace for `jobs`.`data_employer` because it could not be opened.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11  0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11  0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\education.ibd' OS error: 203
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11  0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11  0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for ``jobs`.`education``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11  0:08:23 0 [Warning] InnoDB: Ignoring tablespace for `jobs`.`education` because it could not be opened.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11  0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11  0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\education_list.ibd' OS error: 203
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11  0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11  0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for ``jobs`.`education_list``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11  0:08:23 0 [Warning] InnoDB: Ignoring tablespace for `jobs`.`education_list` because it could not be opened.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11  0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11  0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\industry.ibd' OS error: 203
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11  0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11  0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for ``jobs`.`industry``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11  0:08:23 0 [Warning] InnoDB: Ignoring tablespace for `jobs`.`industry` because it could not be opened.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11  0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11  0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\jobs.ibd' OS error: 203
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11  0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11  0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for ``jobs`.`jobs``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11  0:08:23 0 [Warning] InnoDB: Ignoring tablespace for `jobs`.`jobs` because it could not be opened.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11  0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11  0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\login.ibd' OS error: 203
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11  0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11  0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for ``jobs`.`login``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11  0:08:23 0 [Warning] InnoDB: Ignoring tablespace for `jobs`.`login` because it could not be opened.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11  0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11  0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\login_admini.ibd' OS error: 203
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11  0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11  0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for ``jobs`.`login_admini``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11  0:08:23 0 [Warning] InnoDB: Ignoring tablespace for `jobs`.`login_admini` because it could not be opened.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11  0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11  0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\login_employer.ibd' OS error: 203
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11  0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11  0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for ``jobs`.`login_employer``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11  0:08:23 0 [Warning] InnoDB: Ignoring tablespace for `jobs`.`login_employer` because it could not be opened.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11  0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11  0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\resume.ibd' OS error: 203
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11  0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11  0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for ``jobs`.`resume``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11  0:08:23 0 [Warning] InnoDB: Ignoring tablespace for `jobs`.`resume` because it could not be opened.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11  0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11  0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\jobs\selected.ibd' OS error: 203
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11  0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11  0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for ``jobs`.`selected``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11  0:08:23 0 [Warning] InnoDB: Ignoring tablespace for `jobs`.`selected` because it could not be opened.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11  0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11  0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\projects\entries.ibd' OS error: 203
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11  0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11  0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for ``projects`.`entries``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11  0:08:23 0 [Warning] InnoDB: Ignoring tablespace for `projects`.`entries` because it could not be opened.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11  0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11  0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\projects\geoname.ibd' OS error: 203
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11  0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11  0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for ``projects`.`geoname``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11  0:08:23 0 [Warning] InnoDB: Ignoring tablespace for `projects`.`geoname` because it could not be opened.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11  0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11  0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\projects\geonamebackup.ibd' OS error: 203
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11  0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11  0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for ``projects`.`geonamebackup``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11  0:08:23 0 [Warning] InnoDB: Ignoring tablespace for `projects`.`geonamebackup` because it could not be opened.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11  0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11  0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\projects\pincodes.ibd' OS error: 203
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11  0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11  0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for ``projects`.`pincodes``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11  0:08:23 0 [Warning] InnoDB: Ignoring tablespace for `projects`.`pincodes` because it could not be opened.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11  0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11  0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\projects\specifier.ibd' OS error: 203
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11  0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11  0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for ``projects`.`specifier``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11  0:08:23 0 [Warning] InnoDB: Ignoring tablespace for `projects`.`specifier` because it could not be opened.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 3 in a file operation.
2021-06-11  0:08:23 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2021-06-11  0:08:23 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-06-11  0:08:23 0 [ERROR] InnoDB: Cannot open datafile for read-only: '.\projects\users.ibd' OS error: 203
2021-06-11  0:08:23 0 [ERROR] InnoDB: Operating system error number 203 in a file operation.
2021-06-11  0:08:23 0 [Note] InnoDB: Some operating system error numbers are described at https://mariadb.com/kb/en/library/operating-system-error-codes/
2021-06-11  0:08:23 0 [ERROR] InnoDB: Could not find a valid tablespace file for ``projects`.`users``. Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/ for how to resolve the issue.
2021-06-11  0:08:23 0 [Warning] InnoDB: Ignoring tablespace for `projects`.`users` because it could not be opened.
2021-06-11  0:08:23 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2021-06-11  0:08:23 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-06-11  0:08:23 0 [Note] InnoDB: Setting file 'D:\Program Files\XAMP\mysql\data\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2021-06-11  0:08:23 0 [Note] InnoDB: File 'D:\Program Files\XAMP\mysql\data\ibtmp1' size is now 12 MB.
2021-06-11  0:08:23 0 [Note] InnoDB: Waiting for purge to start
2021-06-11  0:08:23 0 [Note] InnoDB: 10.4.19 started; log sequence number 1515509790; transaction id 611499
2021-06-11  0:08:23 0 [Note] InnoDB: Loading buffer pool(s) from D:\Program Files\XAMP\mysql\data\ib_buffer_pool
2021-06-11  0:08:23 0 [Note] Plugin 'FEEDBACK' is disabled.
2021-06-11  0:08:23 0 [Note] Server socket created on IP: '::'.

能夠取回數據。

第一步:將mysql/ data目錄下的所有文件移動到data_old目錄下,mysql和performance_schema目錄除外。

步驟 2:從備份目錄複製回ibdata1文件,同時複製回帶有您要恢復的數據庫名稱的文件夾。

第三步:現在啟動mysql,就可以看到數據庫了。使用mysqldump導出到 sql 文件。

第四步:解除安裝mysql/xampp。重新安裝 xampp。

第五步:用備份數據庫的名字創建一個數據庫。並使用 mysqldump 恢復數據。

另請記住,刪除數據庫後 phpMyAdmin 可能無法正常工作,因此您可能需要切換到控制台。

引用自:https://dba.stackexchange.com/questions/294097