首页 文章

错误'Unknown table engine ' InnoDB''查询 . 重启mysql后

提问于
浏览
9

我在服务器S1上有mysql DB(mysql版本5.1.41-3ubuntu12.7-log),我在服务器S2上创建了这个DB的主从(mysql版本5.1.54-1ubuntu4-log) .
S1上的DB使用一个数据文件(ibdata) . 在将数据库转储到S2之后,我设置了innodb_file_per_table = 1 . 这使得每个表都有自己的ibd文件 . 现在一切都很顺利 .
但在S2上重启mysql后,我遇到了出现此错误的问题:
Error 'Unknown table engine 'InnoDB'' on query. Default database: MyDB 当我试图展示引擎时

show engines;
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine     | Support | Comment                                                        | Transactions | XA   | Savepoints |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| MyISAM     | DEFAULT | Default engine as of MySQL 3.23 with great performance         | NO           | NO   | NO         |
| MRG_MYISAM | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |
| BLACKHOLE  | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |
| CSV        | YES     | CSV storage engine                                             | NO           | NO   | NO         |
| MEMORY     | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |
| FEDERATED  | NO      | Federated MySQL storage engine                                 | NULL         | NULL | NULL       |
| ARCHIVE    | YES     | Archive storage engine                                         | NO           | NO   | NO         |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+

innodb未列出 .
在错误日志中,我可以看到:

InnoDB: Database physically writes the file full: wait...
InnoDB: Cannot initialize created log files because
InnoDB: data files are corrupt, or new data files were
InnoDB: created when the database was started previous
InnoDB: time but the database was not shut down
InnoDB: normally after that.
111016  8:24:11 [ERROR] Plugin 'InnoDB' init function returned error.
111016  8:24:11 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
111016  8:24:11 [Warning] Neither --relay-log nor --relay-log-index were used; so replication may break when this MySQL server acts as a slave and has his hostname changed!! Please use '--relay-log=S2-relay-bin' to avoid this problem.

我试图删除ib_logfiles,但这不起作用 .
有谁在面对这样的问题?任何想法都非常感谢
谢谢

5 回答

  • 19

    我觉得如果你设置 innodb_buffer_pool_size = 2G ,innodb配置mysql for innodb将不起作用 .

    通常它会出错

    "Unknown table engine 'InnoDB".
    

    如果你用innodb系统选择表尝试innodb_buffer_pool_size = 1G .

  • 2

    服务器挂起并重启后有类似的问题 .

    数据没问题 - 错误信息非常误导 .

    停止MySQL服务,从 /var/lib/mysql 删除日志文件( ib_logfile* ),然后重新启动MySQL服务 . 只需确保在删除日志文件时MySQL实际上已关闭 .

  • 4

    您可以删除名为ib_logfile0和ib_logfile1的mysql数据目录中的InnoDB日志文件 . 不要删除InnoDB数据文件(ibdata1) .

    之后,InnoDB将在您重启mysqld后尝试恢复 .

    看看主日志文件:

    120413 17:34:47  InnoDB: Initializing buffer pool, size = 64.0M
    120413 17:34:47  InnoDB: Completed initialization of buffer pool
    120413 17:34:47  InnoDB: Log file .\ib_logfile0 did not exist: new to be created
    InnoDB: Setting log file .\ib_logfile0 size to 32 MB
    InnoDB: Database physically writes the file full: wait...
    120413 17:34:48  InnoDB: Log file .\ib_logfile1 did not exist: new to be created
    InnoDB: Setting log file .\ib_logfile1 size to 32 MB
    InnoDB: Database physically writes the file full: wait...
    InnoDB: The log sequence number in ibdata files does not match
    InnoDB: the log sequence number in the ib_logfiles!
    120413 17:34:49  InnoDB: Database was not shut down normally!
    InnoDB: Starting crash recovery.
    
  • 0

    你用innodb编译mysql了吗?如果你这样做了,你运行它时应该有大量的行引用它:

    strings `which mysqld` | grep innodb
    
  • 1

    我遇到了同样的问题 . Nikl的回答帮助我在主日志文件中找到了问题 . InnoDB无法在启动时分配所需的内存 . 清理完一些其他过程后,一切正常 .

    日志显示以下内容:

    160219 9:20:23 InnoDB: Error: cannot allocate 12884918272 bytes of InnoDB: memory with malloc! Total allocated memory InnoDB: by InnoDB 49601872 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...

相关问题