Welcome 微信登录

首页 / 数据库 / MySQL / 如何找回消失的InnoDB引擎

如何找回消失的InnoDB引擎2014-10-22夜里重做主从复制,顺便调整了下从库的my.cnf。早上想起从库忘了重启,打完命令接着开启slave,居然报错

Last_SQL_Errno: 1286
Last_SQL_Error: Error executing row event: "Unknown storage engine "InnoDB""

奇怪,怎么会报错不知道存储引擎InnoDB。查看下引擎:

mysql> show engines;+--------------------+---------+-----------------------------------------------------------+--------------+------+------------+| Engine | Support | Comment | Transactions | XA | Savepoints |+--------------------+---------+-----------------------------------------------------------+--------------+------+------------+| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO || PERFORMANCE_SCHEMA | YES | Performance Schema| NO | NO | NO || MyISAM | DEFAULT | MyISAM storage engine | NO | NO | NO || CSV| YES | CSV storage engine| NO | NO | NO || MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |+--------------------+---------+-----------------------------------------------------------+--------------+------+------------+5 rows in set (0.01 sec)
没了,InnoDB真的没了。我的心一下慌了,从来没听说过过引擎会自己消失的啊!再看看错误日志怎么说

1308298:42:30 [Note] Slave I/O thread: connected to master "slave@192.168.0.153:3306",replication started in log "mysql-bin.000023" at position 2325465661308298:42:30 [ERROR] Slave SQL: Error executing row event: "Unknown storage engine "InnoDB"", Error_code: 12861308298:42:30 [Warning] Slave: Unknown storage engine "InnoDB" Error_code: 12861308298:42:30 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log "mysql-bin.000023" position 225856952
看来InnoDB确实消失了。

遇到问题要先靠自己,这样才会提高自己。想想事件的过程:InnoDB消失了。为什么会消失?为什么是今天消失?我都有做过什么?好好想想。。。。

URL:http://www.bianceng.cn/database/MySQL/201410/46084.htm

配置文件,没错,我夜里调整了my.cnf,然后早上重启mysql,然后InnoDB不见了。OK,原因找到了。赶紧将调整前后的配置文件对比,看看咱都改了哪些啊,发现了最可疑的一个配置项:

innodb_log_files_in_group = 3

改回调整前的值2,重启mysql,开启slave,复制正常了,查看引擎,InnoDB也回来了!万幸啊。InnoDB的消失其实是因为修改配置导致mysql生成新的ib_logfile日志与旧的ib_logfile日志混乱引起的。整理下修改此配置项的操作步骤

service mysqld stopcd到数据目录下mv ib_logfile* 到其他目录下修改innodb_log_files_in_groupservice mysqld start