How to convert MyISAM to InnoDBÂ
To convert all MyISAM tables to InnoDB tables in a MySQL database using a single query, you can use the following SQL statement:
SELECT CONCAT(‘ALTER TABLE ‘, table_name, ‘ ENGINE=InnoDB;’) AS sql_statements
FROM information_schema.tables
WHERE table_schema = ‘your_database_name’ AND engine = ‘MyISAM’;
Replace ‘your_database_name’ with the name of your database.
This query generates a list of ALTER TABLE statements for each MyISAM table in your specified database. When you run the query, it will produce a result set with a column called sql_statements containing the ALTER TABLE statements.
Export the results as a CSV. Open the CSV. You can then copy and paste these statements and execute them to convert the MyISAM tables to InnoDB.