Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error 'Unknown table engine 'InnoDB'' on query. after restarting mysql

I have mysql DB on server S1 (mysql version 5.1.41-3ubuntu12.7-log), i have created master-slave for this DB on server S2 (mysql version 5.1.54-1ubuntu4-log).
the DB on S1 was using one data file (ibdata). after dumping the DB to S2 i set innodb_file_per_table=1. this made every table to have its own ibd file. now everything went fine and smoothly.
but after restarting mysql on S2, i faced a problem with getting this error:
Error 'Unknown table engine 'InnoDB'' on query. Default database: MyDB and when i try to show engines

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 is not listed.
in error log i can see this:

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.

I have tried to delete ib_logfiles but this didn't work as well.
anybody faced such issue before?? any idea is highly appreciated
Thanks

like image 414
Alaa Avatar asked Oct 16 '11 07:10

Alaa


People also ask

How do I enable InnoDB support in MySQL?

In my. ini (located in MySQL folder) put a # sign before 'skip-innodb' to disable this command. Then restart mysql. This will enable InnoDB engine.

What does engine InnoDB mean in MySQL?

InnoDB is a general-purpose storage engine that balances high reliability and high performance. In MySQL 5.6, InnoDB is the default MySQL storage engine. Unless you have configured a different default storage engine, issuing a CREATE TABLE statement without an ENGINE clause creates an InnoDB table.


3 Answers

Had similar issue after server hanging and restart.

Data is okay - the error message is very misleading.

Stop MySQL service, delete the log files (ib_logfile*) from /var/lib/mysql, and start MySQL service back. Just make 100% sure that MySQL is actually down when deleting log files.

like image 43
Sych Avatar answered Oct 17 '22 16:10

Sych


You can delete the InnoDB log files in your mysql data directory called ib_logfile0 and ib_logfile1. Don't delete the InnoDB data file (ibdata1) though.

After that, InnoDB will try to recover after you restart mysqld.

look at main log file:

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.
like image 112
Nikl Avatar answered Oct 17 '22 15:10

Nikl


I think configuration of mysql for innodb if you set innodb_buffer_pool_size = 2G, innodb will not work.

Usually it gives an error

"Unknown table engine 'InnoDB".

if you select table with innodb system try innodb_buffer_pool_size = 1G.

like image 27
Pathic Avatar answered Oct 17 '22 16:10

Pathic