Search code examples
mysqldatabase-designinnodbmyisam

Can you alter the table to change engine types in MySQL? (MYISAM to INNODB)


I would rather not drop my table entirely to create a new one, but I need to change the ENGINE type from MYISAM to INNODBfor foreign key contraints.

  • Can I do this on the fly with an Alter table? Or do I have to start from scratch with a new table?

  • Would it matter if I already had data in that table which needs to be altered / dropped & recreated ?


Solution

  • From the manual:

        ALTER TABLE t1 ENGINE=InnoDB;