【发布时间】:2017-03-02 09:04:28
【问题描述】:
我正在本地开发并使用 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:试图打开以前打开的表空间。
以前的表空间affiliate_blog_1_old/wpab1_7_woocommerce_order_itemmeta 使用空间 ID:367 在文件路径:./affiliate_blog_1_old/wpab1_7_woocommerce_order_itemmeta.ibd。
无法打开使用空间 ID: 367 的表空间freshwp/freshwp_wfblocksadv 在文件路径:./freshwp/freshwp_wfblocksadv.ibd
【问题讨论】:
-
这是一个非常好的错误信息。它不仅告诉您发生了什么以及原因,它还为您提供了 3 个关于如何解决问题的选项。你试过了吗? (另外:以防万一,请先复制您的数据目录)。
-
在这之前发生了什么?似乎发生了崩溃和/或对数据文件进行了一些不明智的修改。
-
@Solarflare 是的,我通过添加“innodb_force_recovery > 0”尝试了选项 3,但它没有做任何事情。其他解决方案......好吧,我只是不习惯执行它们/不知道如何。
-
@Michael-sqlbot 我在管理后端页面上的 WP 网站上工作,只是设置网站,我不知道,没什么异常。
-
是唯一的错误,和/或数据库是否会在之后工作(或者可能只是看起来工作)。或者,如果没有导致崩溃的一些根本原因(例如损坏的 ram 或 hdd)。为了提高你的几率,你可以雇人为你做这件事。但在你的情况下,它似乎不是一个生产站点,也不是重要数据,重新安装你的 wp 主题可能会修复它。所以要高兴它现在而不是以后发生。使用它作为备份的提示(有 wordpress 插件)。顺便说一句,您雇用的任何人都会问的第一件事是:“您的备份有多久了”。