MySQL 中没有 INNODB 引擎是有原因的。如果您的 innodb_buffer_pool_size 变量太高并且 MySQL 无法分配缓冲区,它将禁用 INNODB 引擎。
您应该在错误日志中看到类似的内容:
140204 13:12:26 InnoDB: Initializing buffer pool, size = 4.9G
140204 13:12:26 InnoDB: Error: cannot allocate 5242896384 bytes of
InnoDB: memory with malloc! Total allocated memory
InnoDB: by InnoDB 36878736 bytes. Operating system errno: 12
InnoDB: Check if you should increase the swap file or
InnoDB: ulimits of your operating system.
InnoDB: On FreeBSD check you have compiled the OS with
InnoDB: a big enough maximum process size.
InnoDB: Note that in most 32-bit computers the process
InnoDB: memory space is limited to 2 GB or 4 GB.
InnoDB: We keep retrying the allocation for 60 seconds...
140204 13:13:26InnoDB: Fatal error: cannot allocate the memory for the buffer pool
140204 13:13:26 [ERROR] Plugin 'InnoDB' init function returned error.
140204 13:13:26 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
此错误记录在具有 1GB RAM 的服务器上,而缓冲池请求 4.9G
另外,确保 mysql 用户可以写入 /tmp。还原后,我得到了“未知表引擎 InnoDB”,其中 /tmp 对该用户不可写。
可能没有引擎“InnoDBopt”
尝试show engines;
如果mysql返回类似
+------------+----------+----
| Engine | Support | ...
+------------+----------+----
| InnoDB | DISABLED | ...
很可能引擎 innodb 已被禁用。在你的mysql配置中寻找选项skip-innodb(例如my.cnf),注释掉这个选项,重启mysql守护进程,它应该修复