Search code examples
mysqldatabaseinnodbmyisam

Alter all database tables engine to InnoDB


I want to use an sql query, to alter all my database tables engine from MyISAM to InnoDB.
I used the query below. Although it gives me a success message, it doesn t work. Still my table s Storage Engine is MyISAM.

SELECT CONCAT('ALTER TABLE ', table_name, ' ENGINE=InnoDB;') as ExecuteTheseSQLCommands
FROM information_schema.tables WHERE table_schema = 'name_of_the_database' 
ORDER BY table_name DESC;

Solution

  • See http://dev.mysql.com/doc/refman/5.0/en/converting-tables-to-innodb.html

    ALTER TABLE t1 ENGINE=InnoDB;
    

    edit: oh wait, you generated this kind of statements, but they did not work?