MySQL 的问题 - InnoDB:文件操作中的操作系统错误编号 2
Trouble with MySQL - InnoDB: Operating system error number 2 in a file operation
我正在本地开发并使用 Mamp Pro。
基本上 MySQL 无法启动,这是错误日志中的错误消息:
知道如何解决这个问题吗?
2017-03-02 00:39:08 9518 [Note] Plugin 'FEDERATED' is disabled.
2017-03-02 00:39:08 9518 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-03-02 00:39:08 9518 [Note] InnoDB: The InnoDB memory heap is disabled
2017-03-02 00:39:08 9518 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-03-02 00:39:08 9518 [Note] InnoDB: Memory barrier is not used
2017-03-02 00:39:08 9518 [Note] InnoDB: Compressed tables use zlib 1.2.8
2017-03-02 00:39:08 9518 [Note] InnoDB: Using CPU crc32 instructions
2017-03-02 00:39:08 9518 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-03-02 00:39:08 9518 [Note] InnoDB: Completed initialization of buffer pool
2017-03-02 00:39:08 9518 [Note] InnoDB: Highest supported file format is Barracuda.
2017-03-02 00:39:08 9518 [Note] InnoDB: Log scan progressed past the checkpoint lsn 663573438
2017-03-02 00:39:08 9518 [Note] InnoDB: Database was not shutdown normally!
2017-03-02 00:39:08 9518 [Note] InnoDB: Starting crash recovery.
2017-03-02 00:39:08 9518 [Note] InnoDB: Reading tablespace information from the .ibd files...
2017-03-02 00:39:08 9518 [ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace affiliate_blog_1_old/wpab1_7_woocommerce_order_itemmeta uses space ID: 367 at filepath: ./affiliate_blog_1_old/wpab1_7_woocommerce_order_itemmeta.ibd. Cannot open tablespace freshwp/freshwp_wfblocksadv which uses space ID: 367 at filepath: ./freshwp/freshwp_wfblocksadv.ibd
2017-03-02 00:39:08 7fff7b652000 InnoDB: Operating system error number 2 in a file operation.
InnoDB: The error means the system cannot find the path specified.
InnoDB: If you are installing InnoDB, remember that you must create
InnoDB: directories yourself, InnoDB does not create them.
InnoDB: Error: could not open single-table tablespace file ./freshwp/freshwp_wfblocksadv.ibd
InnoDB: We do not continue the crash recovery, because the table may become
InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.
InnoDB: To fix the problem and start mysqld:
InnoDB: 1) If there is a permission problem in the file and mysqld cannot
InnoDB: open the file, you should modify the permissions.
InnoDB: 2) If the table is not needed, or you can restore it from a backup,
InnoDB: then you can remove the .ibd file, and InnoDB will do a normal
InnoDB: crash recovery and ignore that table.
InnoDB: 3) If the file system or the disk is broken, and you cannot remove
InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf
InnoDB: and force InnoDB to continue crash recovery here.
170302 00:39:08 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended
从上面的代码来看,错误似乎是:
2017-03-02 00:39:08 9518 [错误] InnoDB:试图打开以前打开的 tablespace。
上一个 tablespace affiliate_blog_1_old/wpab1_7_woocommerce_order_itemmeta
使用 space ID:367
在文件路径:./affiliate_blog_1_old/wpab1_7_woocommerce_order_itemmeta.ibd。
打不开tablespace freshwp/freshwp_wfblocksadv 使用space ID: 367
在文件路径:./freshwp/freshwp_wfblocksadv.ibd
最近使用 MAMP 在本地开发时遇到了类似的问题。日志包括 "Database was not shutdown normally"、之后的类似错误消息以及建议。以下是解决问题的步骤:
- 停止 MAMP 中的服务器
- 导航到您的 WP 数据库的 .idb 文件 - 如果使用 MAMP,应该类似于 ~/Library/Application Support/appsolute/MAMP PRO/db/mysql56/[yourdbname]/
- 将 .bk(或任何无法识别的扩展名)添加到 .idb 文件名的末尾
- 在 MAMP 中启动服务器。如果您查看日志,您会看到一堆与找不到 .idb 文件相关的错误消息,但至少 MySQL 应该开始。
- 停止 MAMP 中的服务器
- 从 .idb 文件名中删除 .bk(或您使用的任何内容)
- 在 MAMP 中启动服务器 - 此时,应该已全部设置好。
还没有对数据库做太多工作,所以愿意丢失数据甚至重新安装 MAMP;如果您的情况不同,可能最好先将您的 db 目录备份到一个 .zip 文件,这样如果运气不好,您可以稍后再尝试其他操作。
希望这对您有所帮助。
.....
更新:
发现用以下内容替换步骤 3 和 6 会更快:
3. 在方便的地方创建一个临时文件夹; select 所有 .idb 文件并将它们移动到该文件夹中。
6. 将文件移回步骤 2 中的原始文件夹。
....
我正在本地开发并使用 Mamp Pro。 基本上 MySQL 无法启动,这是错误日志中的错误消息:
知道如何解决这个问题吗?
2017-03-02 00:39:08 9518 [Note] Plugin 'FEDERATED' is disabled.
2017-03-02 00:39:08 9518 [Note] InnoDB: Using atomics to ref count buffer pool pages
2017-03-02 00:39:08 9518 [Note] InnoDB: The InnoDB memory heap is disabled
2017-03-02 00:39:08 9518 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2017-03-02 00:39:08 9518 [Note] InnoDB: Memory barrier is not used
2017-03-02 00:39:08 9518 [Note] InnoDB: Compressed tables use zlib 1.2.8
2017-03-02 00:39:08 9518 [Note] InnoDB: Using CPU crc32 instructions
2017-03-02 00:39:08 9518 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2017-03-02 00:39:08 9518 [Note] InnoDB: Completed initialization of buffer pool
2017-03-02 00:39:08 9518 [Note] InnoDB: Highest supported file format is Barracuda.
2017-03-02 00:39:08 9518 [Note] InnoDB: Log scan progressed past the checkpoint lsn 663573438
2017-03-02 00:39:08 9518 [Note] InnoDB: Database was not shutdown normally!
2017-03-02 00:39:08 9518 [Note] InnoDB: Starting crash recovery.
2017-03-02 00:39:08 9518 [Note] InnoDB: Reading tablespace information from the .ibd files...
2017-03-02 00:39:08 9518 [ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace affiliate_blog_1_old/wpab1_7_woocommerce_order_itemmeta uses space ID: 367 at filepath: ./affiliate_blog_1_old/wpab1_7_woocommerce_order_itemmeta.ibd. Cannot open tablespace freshwp/freshwp_wfblocksadv which uses space ID: 367 at filepath: ./freshwp/freshwp_wfblocksadv.ibd
2017-03-02 00:39:08 7fff7b652000 InnoDB: Operating system error number 2 in a file operation.
InnoDB: The error means the system cannot find the path specified.
InnoDB: If you are installing InnoDB, remember that you must create
InnoDB: directories yourself, InnoDB does not create them.
InnoDB: Error: could not open single-table tablespace file ./freshwp/freshwp_wfblocksadv.ibd
InnoDB: We do not continue the crash recovery, because the table may become
InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.
InnoDB: To fix the problem and start mysqld:
InnoDB: 1) If there is a permission problem in the file and mysqld cannot
InnoDB: open the file, you should modify the permissions.
InnoDB: 2) If the table is not needed, or you can restore it from a backup,
InnoDB: then you can remove the .ibd file, and InnoDB will do a normal
InnoDB: crash recovery and ignore that table.
InnoDB: 3) If the file system or the disk is broken, and you cannot remove
InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf
InnoDB: and force InnoDB to continue crash recovery here.
170302 00:39:08 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended
从上面的代码来看,错误似乎是:
2017-03-02 00:39:08 9518 [错误] InnoDB:试图打开以前打开的 tablespace。
上一个 tablespace affiliate_blog_1_old/wpab1_7_woocommerce_order_itemmeta 使用 space ID:367 在文件路径:./affiliate_blog_1_old/wpab1_7_woocommerce_order_itemmeta.ibd。
打不开tablespace freshwp/freshwp_wfblocksadv 使用space ID: 367 在文件路径:./freshwp/freshwp_wfblocksadv.ibd
最近使用 MAMP 在本地开发时遇到了类似的问题。日志包括 "Database was not shutdown normally"、之后的类似错误消息以及建议。以下是解决问题的步骤:
- 停止 MAMP 中的服务器
- 导航到您的 WP 数据库的 .idb 文件 - 如果使用 MAMP,应该类似于 ~/Library/Application Support/appsolute/MAMP PRO/db/mysql56/[yourdbname]/
- 将 .bk(或任何无法识别的扩展名)添加到 .idb 文件名的末尾
- 在 MAMP 中启动服务器。如果您查看日志,您会看到一堆与找不到 .idb 文件相关的错误消息,但至少 MySQL 应该开始。
- 停止 MAMP 中的服务器
- 从 .idb 文件名中删除 .bk(或您使用的任何内容)
- 在 MAMP 中启动服务器 - 此时,应该已全部设置好。
还没有对数据库做太多工作,所以愿意丢失数据甚至重新安装 MAMP;如果您的情况不同,可能最好先将您的 db 目录备份到一个 .zip 文件,这样如果运气不好,您可以稍后再尝试其他操作。
希望这对您有所帮助。
.....
更新:
发现用以下内容替换步骤 3 和 6 会更快:
3. 在方便的地方创建一个临时文件夹; select 所有 .idb 文件并将它们移动到该文件夹中。
6. 将文件移回步骤 2 中的原始文件夹。
....