Skip to content

Instantly share code, notes, and snippets.

@simonkberg
Last active December 19, 2015 00:28
Show Gist options
  • Save simonkberg/5868471 to your computer and use it in GitHub Desktop.
Save simonkberg/5868471 to your computer and use it in GitHub Desktop.
All tables to InnoDB Convert to UTF8
SELECT CONCAT('ALTER TABLE ',table_schema,'.',table_name,' ENGINE=InnoDB;')
FROM information_schema.tables
WHERE 1=1
AND engine <> 'MyISAM'
AND table_schema NOT IN ('information_schema', 'mysql', 'performance_schema');
SELECT CONCAT('ALTER TABLE ',table_schema,'.',table_name,' CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;')
FROM information_schema.tables
WHERE 1=1
AND collate <> 'utf8_general_ci';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment