Mysql changing table engine MyISAM to InnoDB

Idob picture Idob · Feb 3, 2014 · Viewed 12.4k times · Source

On my site I have a visitor's table with 10 million rows.
Every request to the site inserts row to the table, in case the table is locked (usually in optimize query) visitors can't get into the site
The table engine is MyISAM and I want to change it to InnoDB
I have few questions:

  • How can I change the table engine without stoping my site from working
  • There is a way to optimize InnoDB table without locking it

Answer

oleksii.svarychevskyi picture oleksii.svarychevskyi · Feb 3, 2014

The easiest way is

ALTER TABLE table_name ENGINE = InnoDB;

If you use InnoDB engine you should not worry about locking tables, because this engine locks data by rows.