Skip to content

Instantly share code, notes, and snippets.

@krabello
Created September 21, 2018 18:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krabello/6dd64402cc51f42525b77eaf150637d5 to your computer and use it in GitHub Desktop.
Save krabello/6dd64402cc51f42525b77eaf150637d5 to your computer and use it in GitHub Desktop.
Returns list of queries that will convert all tables in a given schema from MyISAM to InnoDB
SET @DB_NAME = 'your_database';
SELECT CONCAT('ALTER TABLE `',
table_name, '` ENGINE=InnoDB;') AS sql_statements
FROM information_schema.tables AS tb
WHERE table_schema = @DB_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