Skip to content

Instantly share code, notes, and snippets.

@marcusorjames
Last active October 2, 2019 15:55
Show Gist options
  • Save marcusorjames/06306383cbbf3cb57e0f6dd075eeaae8 to your computer and use it in GitHub Desktop.
Save marcusorjames/06306383cbbf3cb57e0f6dd075eeaae8 to your computer and use it in GitHub Desktop.
Convert MyISAM to InnoDB
SET @DATABASE_NAME = 'name_of_your_db';
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;
# Then copy resulting queries and run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment