Skip to content

Instantly share code, notes, and snippets.

@Kcko
Created April 29, 2014 14:53
Show Gist options
  • Save Kcko/11402736 to your computer and use it in GitHub Desktop.
Save Kcko/11402736 to your computer and use it in GitHub Desktop.
Convert tables to InnoDB
SET @DATABASE_NAME = 'test';
SELECT CONCAT('ALTER TABLE ', table_name, ' ENGINE=InnoDB;') AS sql_statements
FROM information_schema.tables AS tb
WHERE table_schema = @DATABASE_NAME
AND `ENGINE` = 'MyISAM'
AND `TABLE_TYPE` = 'BASE TABLE'
ORDER BY table_name DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment