目前,在生产服务器中我们仅使用 MyIsam 表运行,因此我们已使用 skip-innodb 选项禁用 innodb 引擎。但是现在我们还需要启用 innodb 引擎来创建一些 innodb 表。因此,我们在 my.cnf 中注释了 [ #skip-innodb ] 选项并重新启动。请仔细阅读以下案例并请求提供任何解决方案或提示?
情况 1:使用 skip-innodb 选项禁用 innodb,并给出“mysql>show engines”,如下所示。
mysql> show engines;
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
| InnoDB | NO | Supports transactions, row-level locking, and foreign keys | NULL | NULL | NULL |
| 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 |
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
8 rows in set (0.01 sec)
Engine | Support ...
| InnoDB | NO ......
情况 2:因为我想启用 innodb,我命令了 #skip-innodb 选项并重新启动。但现在 show engines 甚至没有在列表中显示 InnoDB 引擎。?
mysql> 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 |
+------------+---------+----------------------------------------------------------------+--------------+------+------------+
7 rows in set (0.00 sec)
Mysql 版本:5.1.57-community-log 操作系统:CentOS 版本 5.7(最终版)
日志:
120622 13:06:36 InnoDB: Initializing buffer pool, size = 8.0M
120622 13:06:36 InnoDB: Completed initialization of buffer pool
InnoDB: No valid checkpoint found.
InnoDB: If this error appears when you are creating an InnoDB database,
InnoDB: the problem may be that during an earlier attempt you managed
InnoDB: to create the InnoDB data files, but log file creation failed.
InnoDB: If that is the case, please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/error-creating-innodb.html
120622 13:06:36 [ERROR] Plugin 'InnoDB' init function returned error.
120622 13:06:36 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
120622 13:06:36 [Note] Event Scheduler: Loaded 0 events
120622 13:06:36 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.1.57-community-log' socket: '/data/mysqlsnd/mysql.sock1' port: 3307 MySQL Community Server (GPL)
答案1
您的日志文件可能已损坏。请尝试以下操作:
- 停止 mysql。
- 由于 innodb 表中没有以前的数据,请删除(或移动到其他地方)日志文件,它们应该像
/var/lib/mysql/ib_logfile0
默认/var/lib/mysql/ib_logfile1
安装中那样命名。 - 再次启动mysql
要显示 mysql innodb 引擎状态,请输入以下命令
mysql> show engine innodb status;