Skip to content

Instantly share code, notes, and snippets.

@xtrasmal
Created June 25, 2018 00:37
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 xtrasmal/760096e01317ca7f9927e0c041382614 to your computer and use it in GitHub Desktop.
Save xtrasmal/760096e01317ca7f9927e0c041382614 to your computer and use it in GitHub Desktop.
Alter all tables collation
SELECT CONCAT("ALTER TABLE ",TABLE_SCHEMA,".",TABLE_NAME," CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ",
"ALTER TABLE ",TABLE_SCHEMA,".",TABLE_NAME," CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ")
AS alter_sql
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = 'mist';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment